When creating website to host WCF service, edit wcf config gives “no service found”

久未见 提交于 2019-12-25 06:36:27

问题


I am new to WCF and have what I think should be a simple question. I created a solution that contains a WCF service library, and a website to host the service. In the website I reference the service library proj, so the service.dll is in my website's /bin. I edited the .svc file in the website to use the referenced project's service, but when I right click on the web.config and choose "Edit WCF Configuration" under services it says "No services defined".

I am following this tutorial, http://www.youtube.com/watch?v=SVPXLF-g4Ws&feature=related and when he does the "Edit WCF Configuration" step, the referenced service is listed.

He is using vs2008, I am using vs2010. Am I missing something? I am hope I have provided is enough info to get some answers.

Thank You


回答1:


I am having this same exact issue, but I recreated my WCF service in VS2008 and it worked. I would love to know why the configuration doesn't recognize the service in VS2010.

Update: I edited the web.config file replacing the System.ServiceModel section with the one from the WCF Library app.config.




回答2:


At first there are no services defined in the configuration file (web.config) - it's defined in the .svc file, and if you try to access it, it will even work (if you're using .net 4.0), as WCF will add a default endpoint if no configuration is found for the service.

If you want to customize the configuration for your service, select "Create a New Service...", then browse to the /bin directory and select the class library DLL. Then you can select the service class, and proceed from there.



来源:https://stackoverflow.com/questions/6286662/when-creating-website-to-host-wcf-service-edit-wcf-config-gives-no-service-fou

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!