Publish a WCFService doesn't work; Debugging-mode works

旧时模样 提交于 2021-01-29 08:21:55

问题


I want to start an default webservice-project, where I can send data over a service. When I go to debug the API through VS then everything works fine, but not when I try to use it over IIS.

I created an WcfServiceLibrary-Project in Visual Studio 2017. I then right-clicked on the project (in the solution explorer) and then published it to a folder A.

I also didn't do anything special at IIS (all the things are still on localhost.): I activated the default windows-feature "IIS". (The default web site got also stopped). Then I added there a site with an random name and the path to the folder A. The service got started.

My access trial was to find anything through Visual Studios "connected services".

Has anyone an idea?


回答1:


At first, please use the WCF service application project template,

or the Appconfig file would not be kicked in. library project needs the additional configuration in the hosting environment, and the Appconfig file could not recognized. We have to move the configuration code into the configuration file recognized by your hosting environment.
https://docs.microsoft.com/en-us/dotnet/framework/wcf/deploying-a-wcf-library-project
Secondly, for hosting the WCF service in IIS, we should enable the below windows feature.
Feel free to let me know if the problem still exists.



来源:https://stackoverflow.com/questions/58026230/publish-a-wcfservice-doesnt-work-debugging-mode-works

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