Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: WCF WebService
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:
 
<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 1-Feb-12 2:36am
Edited 1-Feb-12 2:48am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Can you try adding Namespaces (if any) to your service name?
 
<service behaviorconfiguration="StdBehavior" name="Namespace.LocalSvc">            
        </service>
        <service behaviorconfiguration="StdBehavior" name="Namespace.DevSvc">
        </service>
        <service behaviorconfiguration="StdBehavior" name="Namespace.ProductionSvc">
</service>
  Permalink  
Comments
   
I've already tried that - still the same error message.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I got it to work, but I'm not sure why. I had originally done this:
 
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.
  Permalink  

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



Advertise | Privacy | Mobile
Web03 | 2.8.140709.1 | Last Updated 1 Feb 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid