Click here to Skip to main content
Sign Up to vote bad
good
See more: WCFWebService
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


2 solutions

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  
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.

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Christian Graus 544
1 Ron Beyer 296
2 OriginalGriff 258
3 samadhan_kshirsagar 229
4 Sergey Alexandrovich Kryukov 183
0 Sergey Alexandrovich Kryukov 7,007
1 Prasad_Kulkarni 3,815
2 OriginalGriff 3,557
3 _Amy 3,372
4 CPallini 2,975


Advertise | Privacy | Mobile
Web02 | 2.6.130617.1 | Last Updated 1 Feb 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid