WCF服务通过https而不是http返回404

aro*_*eer 10 https wcf soap

我正在将现有服务从HTTP(Dev/UAT)迁移到HTTPS(生产),我遇到配置问题.这是我的web.config的system.serviceModel部分:

<system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="false" />
    <services>
      <service name="MyService">
        <endpoint name="MyEndpoint" address="" binding="wsHttpBinding"
            bindingConfiguration="secureBinding" contract="IMyService" />
      </service>
    </services>
    <bindings>
      <wsHttpBinding>
        <binding name="secureBinding">
          <security mode="Transport"></security>
        </binding>
      </wsHttpBinding>
    </bindings>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)

我已经试过这同时使用basicHttpBindingwsHttpBinding,与相同的结果:

  • 我可以使用我的SOAP客户端调用该服务 http://server.domain.com/MyService.svc
  • 我可以使用浏览器来点击该服务 https://server.domain.com/MyService.svc
  • 我不能使用https://server.domain.com/MyService.svc- 我的SOAP客户端调用服务- 调用总是错误404: not found.

我的https站点使用由公司域上的CA颁发的证书进行了认证,并且我已经验证我已在Trusted Root Certification Authorities我正在进行呼叫的系统上安装了CA的证书.

相关客户代码:

Service service = new Service();
service.Url = "http://server.domain.com/MyService.svc";
//service.Url = "https://server.domain.com/MyService.svc";
service.WebMethodCall();
Run Code Online (Sandbox Code Playgroud)

编辑

以下是WSDL的请求部分:

<wsdl:types/>
<wsdl:portType name="IMyService"/>
<wsdl:binding name="BasicHttpBinding_IMyService" type="tns:IMyService">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
</wsdl:binding>
<wsdl:service name="MyService">
    <wsdl:port name="BasicHttpBinding_IMyService" 
        binding="tns:BasicHttpBinding_IMyService">
        <soap:address location="http://server.domain.com/MyService.svc"/>
    </wsdl:port>
</wsdl:service>
Run Code Online (Sandbox Code Playgroud)

编辑

更多信息:

当我改变serviceMetadata元素具有httpGetEnabled="false"httpsGetEnabled="true"该.SVC页面显示我下面的链接:

https://boxname.domain.com/MyService.svc?wsdl
Run Code Online (Sandbox Code Playgroud)

而不是预期的

https://server.domain.com/MyService.svc?wsdl
Run Code Online (Sandbox Code Playgroud)

Joh*_*ais 11

检查web.config中的服务元素名称是否与实现合同的类的完全限定名称匹配.

<services>
  <service name="MyNamespace.MyService">
    <endpoint name="MyEndpoint" address="" binding="wsHttpBinding" ...
Run Code Online (Sandbox Code Playgroud)