在IIS中托管WCF会忽略端点

时间:2015-02-13 02:49:41

标签: c# wcf iis

使用svc在IIS上托管WCF服务时,将忽略端点,并且仅创建默认端点。 为什么这样以及如何使端点工作?

我的设置:

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>

当我导航到http://localhost:24906/service.svc时 我收到消息告诉我我创建了一个服务,我可以去http://localhost:24906/service.svc?wsdl获取元数据。 但是,元数据并没有给我任何端点!

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

非常感谢任何帮助。

0 个答案:

没有答案