Click here to Skip to main content
15,894,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'me developing a WCF web service. I want to be able to use it on my local box (for debugging purposes, and deploy it to two secure web sites. I've come up with the following service model configuration:

HTML
<system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior name="StdBehavior">
                <serviceMetadata httpGetEnabled="true"/>
                <serviceDebug includeExceptionDetailInFaults="true"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <bindings>
        <basicHttpBinding >
            <binding name="secureBind">
                <security mode="Transport">
                    <transport clientCredentialType="Certificate" />
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <services>
        <service behaviorConfiguration="StdBehavior" name="LocalSvc">
            <endpoint contract="A.ICrisSvc" 
                      name="localEndpoint" 
                      binding="wsHttpBinding" 
                      address="" 
                      />
            <endpoint contract="IMetadataExchange" 
                      name="mexEndpoint" 
                      binding="mexHttpBinding" 
                      address="mex" 
                      />
        </service>
        <service behaviorConfiguration="StdBehavior" name="DevSvc">
            <endpoint contract="A.ICrisSvc" 
                      name="devEndpoint" 
                      binding="basicHttpBinding" 
                      bindingConfiguration="secureBind" 
                      address="https://blah.mil/blah/CrisSvc" 
                      />
        </service>
        <service behaviorConfiguration="StdBehavior" name="ProductionSvc">
            <endpoint contract="A.ICrisSvc" 
                      name="prodEndpoint"
                      binding="basicHttpBinding" 
                      bindingConfiguration="secureBind"  
                      address="https://blah2.mil/blah2/CrisSvc" 
                      />
        </service>
    </services>
</system.serviceModel>


When I try to add a service reference to my desktop application, I get the following error:

Service 'A.CrisSvc' has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element.

It looks to me like I have everything in there that needs to be in there. If I remove the two https services, I can add the reference. What am I doing wrong?
Posted
Updated 1-Feb-12 2:48am
v2

Can you try adding Namespaces (if any) to your service name?

HTML
<service behaviorconfiguration="StdBehavior" name="Namespace.LocalSvc">            
        </service>
        <service behaviorconfiguration="StdBehavior" name="Namespace.DevSvc">
        </service>
        <service behaviorconfiguration="StdBehavior" name="Namespace.ProductionSvc">
</service>
 
Share this answer
 
Comments
#realJSOP 1-Feb-12 9:06am    
I've already tried that - still the same error message.
I got it to work, but I'm not sure why. I had originally done this:

C#
public class CrisSvc : ICrisSvc
{
    // web methods are here
}

public class LocalSvc : CrisSvc
{
    // empty class
}

public class DevSvc : CrisSvc
{
    // empty class
}

public class ProdSvc : CrisSvc
{
    // empty class
}


The error was for the base class, so I thought maybe every class needs an endpoint, even if it's not directly used, so I changed the LocalSvc reference in the config file to be CrisSvc, and I was able to successfully add the service reference. Note that this kinda blew my theory out of the water regarding the requirement for an endpoint for every service. If anyone can clarify what's happening here, I would be most appreciative.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900