WCF SOAP 服务返回 404 Not Found for HTTPS 端点

mim*_*imo 2 c# wcf soap web-services

我在域上的 IIS 8.5 中获得了 .NET 4.5 WCF 服务https://mydomain,并在 IIS 中配置了 https 绑定和自签名证书。

我可以在浏览器中访问我的服务的配置页面 https://mydomain/FileService.svc

当我尝试POST使用 SoapUI将一些数据发送到服务到端点时https://mydomain/FileService.svc/receiveRequest,我回来了HTTP/1.1 404 Not Found

我的 web.config 服务配置如下所示:

<system.serviceModel>
  <bindings>
    <basicHttpBinding>
      <!-- maxReceivedMessageSize = 1073741824 = 1 GB -->
      <binding maxReceivedMessageSize="1073741824" maxBufferSize="1073741824" maxBufferPoolSize="1073741824" >
        <security mode="None"></security>
      </binding>
    </basicHttpBinding>
  </bindings>

  <behaviors>
    <serviceBehaviors>
      <behavior>
        <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="true" />
      </behavior>
    </serviceBehaviors>
  </behaviors>

  <protocolMapping>
    <add binding="basicHttpBinding" scheme="http" />
  </protocolMapping>

  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  <services>

    <service name="Foo.FileService">
      <endpoint contract="IFileService" binding="basicHttpBinding"></endpoint>
    </service>
  </services>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)

知道如何解决这个问题或获取更多信息以进行进一步调试吗?谢谢。

编辑 1

我已经在我的开发机器上测试了该服务。它被部署http://localhost并且来自 SoapUI 的调用起作用了。我曾经http://localhost/FileService.svc/receiveRequest调用服务端点,它用200SOAP 消息进行响应。

编辑 2

在没有它的情况下访问http://mydomain/FileService.svc/receiveRequest我的测试机器上的 WCF 服务端点时HTTPS

mim*_*imo 5

终于破解了!我缺少HTTPS端点的绑定,其中security模式不能设置为None.

这是绑定的更新配置:

<basicHttpBinding>
  <binding name="myHttpsBinding" maxReceivedMessageSize="1073741824" maxBufferSize="1073741824" maxBufferPoolSize="1073741824">
    <security mode="Transport">
      <transport clientCredentialType="None"/>
    </security>
  </binding>

  <binding name="myHttpBinding" maxReceivedMessageSize="1073741824" maxBufferSize="1073741824" maxBufferPoolSize="1073741824">
    <security mode="None" />
  </binding>    
</basicHttpBinding>
Run Code Online (Sandbox Code Playgroud)

这是服务端点的更新配置:

<service name="Foo.FileService">
  <!-- HTTPS Endpoint -->
  <endpoint contract="IFileService" binding="basicHttpBinding" bindingConfiguration="myHttpsBinding" ></endpoint>
  <!-- HTTP Endpoint -->
  <endpoint contract="IFileService" binding="basicHttpBinding" bindingConfiguration="myHttpBinding" ></endpoint>
</service>
Run Code Online (Sandbox Code Playgroud)

现在,两个端点http://mydomain/FileService.svc/receiveRequesthttps://mydomain/FileService.svc/receiveRequest我的工作。