1

When hosting WCF service on IIS using svc, the endpoints are ignored and only a default one is created. Why is that and how to I make the endpoints work?

My setup:

service.svc

<%@ServiceHost language=c# Debug="true" Service="ComputerStudyService.SectionHandlerService"%>

web.config

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0"/>
  </system.web>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MyServiceTypeBehaviors">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service name="ComputerStudyService.SectionHandlerService" behaviorConfiguration="MyServiceTypeBehaviors">
        <endpoint address="/" binding="wsHttpBinding" contract="ServicesLibrary.ISectionHandlerService"/>
        <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="/mex"/>
      </service>
    </services>
  </system.serviceModel>
</configuration>

When I navigate to http://localhost:24906/service.svc I get the message telling me I created a service and I can go http://localhost:24906/service.svc?wsdl to get the meta. However the metadata doesn't give me any of my endpoints!

<wsdl:service name="SectionHandlerService">
  <wsdl:port name="WSHttpBinding_ISectionHandlerService" binding="tns:WSHttpBinding_ISectionHandlerService">
    <soap12:address location="http://localhost:24906/service.svc"/>
    <wsa10:EndpointReference>
      <wsa10:Address>http://localhost:24906/service.svc</wsa10:Address>
      <Identity xmlns="http://schemas.xmlsoap.org/ws/2006/02/addressingidentity">
        <Upn>Roi-PC\Roi</Upn>
      </Identity>
    </wsa10:EndpointReference>
  </wsdl:port>
</wsdl:service>

Any help would be much appreciated.

atlanteh
  • 5,615
  • 2
  • 33
  • 54

0 Answers0