Service has zero application (non-infrastructure) endpoints

后端 未结 16 1663
抹茶落季
抹茶落季 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:21

    As another clue, that indeed fixed this issue in my case.

    I'm migrating some WCF services from a console application (that configures in code few WCF services) to an Azure WebRole to publish them in Azure. Every time I add a new service VS edits my web.config and adds this line:

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true">
    

    Well, with all the advices and answers above I couldn't make it work until I removed all the attributes in the serviceHostingEnvironment element. As you can see I'm not a WCF rockstar but I made it to work with the first Service just by configuring it as:

    <service name="FirstService" behaviorConfiguration="metadataBehavior">
                    <endpoint address=""
                     binding="wsHttpBinding"
                     bindingConfiguration="WSHttpBinding_WcfServicesBinding"
                     contract="IFirstService" />
    
                </service>
    

    but when I added the second Service it stoped working and I realized that those attributes where there again.

    I hope it saves you time.

    0 讨论(0)
  • 2020-12-02 18:22

    I got a more detailed exception when I added it programmatically - AddServiceEndpoint:

    string baseAddress = "http://" + Environment.MachineName + ":8000/Service";
    ServiceHost host = new ServiceHost(typeof(Service), new Uri(baseAddress));  
    
    host.AddServiceEndpoint(typeof(MyNamespace.IService),
                            new BasicHttpBinding(), baseAddress);
    host.Open();
    
    0 讨论(0)
  • 2020-12-02 18:23

    I just had this problem and resolved it by adding the namespace to the service name, e.g.

     <service name="TechResponse">
    

    became

     <service name="SvcClient.TechResponse">
    

    I've also seen it resolved with a Web.config instead of an App.config.

    0 讨论(0)
  • 2020-12-02 18:23

    I ran Visual Studio in Administrator mode and it worked for me :) Also, ensure that the app.config file which you are using for writing WCF configuration must be in the project where "ServiceHost" class is used, and not in actual WCF service project.

    0 讨论(0)
  • 2020-12-02 18:24

    My problem was when I renamed my default Service1 class for .svc file to a more meaningful name, which caused web.config behaviorConfiguration and endpoint to correspond to old naming convention. Try to fix your web.config.

    0 讨论(0)
  • 2020-12-02 18:25

    I just ran into this issue and checked all of the above answers to make sure I wasn't missing anything obvious. Well, I had a semi-obvious issue. My casing of my classname in code and the classname I used in the configuration file didn't match.

    For example: if the class name is CalculatorService and the configuration file refers to Calculatorservice ... you will get this error.

    0 讨论(0)
提交回复
热议问题