Service has zero application (non-infrastructure) endpoints

后端 未结 16 1702
抹茶落季
抹茶落季 2020-12-02 18:05

I recently created a WCF service (dll) and a service host (exe). I know my WCF service is working correctly since I am able to successfully add the service to WcfTestClient.

16条回答
  •  南方客
    南方客 (楼主)
    2020-12-02 18:33

    I had the same problem. Everything works in VS2010 but when I run the same project in VS2008 I get the mentioned exception.

    What I did in my VS2008 project to make it work was adding a call to the AddServiceEndpoint member of my ServiceHost object.

    Here is my code snippet:

    Uri baseAddress = new Uri("http://localhost:8195/v2/SystemCallbackListener");
    
    ServiceHost host = new ServiceHost(typeof(SystemCallbackListenerImpl), baseAddress);
    
    host.AddServiceEndpoint(typeof(CsfServiceReference.SystemCallbackListener),
                            new BasicHttpBinding(),
                            baseAddress);
    host.Open();
    

    I didn't modify the app.config file. But I guess the service endpoint could also have been added in the .config file.

提交回复
热议问题