【发布时间】:2019-11-21 06:15:06
【问题描述】:
我有一个多年前编写的 Web 服务,它在 http 上运行良好。它通过网络浏览器工作以查看服务描述并正确响应肥皂调用。我们现在要将其移至 https。
我对 web.config 文件进行了一些更改,以尝试使其能够通过 https 工作。我现在可以在浏览器中通过 https 调用它并查看服务描述,但我无法通过 https 使用肥皂调用调用 Web 服务 - 我收到 404 错误。
我正在使用 Postman 测试肥皂调用,所以这似乎表明问题出在 web.config 或 IIS 上。
我发现很多帖子都存在与 WCF over https 相关的问题,但尚未成功解决此问题。任何帮助将不胜感激。
web.config 中的服务相关代码如下所示。
<system.serviceModel>
<services>
<service name="EComAPI" behaviorConfiguration="WCFAuthBehavior">
<endpoint address="soap" binding="wsHttpBinding" contract="IEComAPI" bindingConfiguration="httpbinding1"></endpoint>
<endpoint address="soap" binding="wsHttpBinding" contract="IEComAPI" bindingConfiguration="httpsbinding1"></endpoint>
<endpoint address="rest" binding="webHttpBinding" contract="IEComAPI" behaviorConfiguration="rest" bindingConfiguration="httpbinding2"></endpoint>
<endpoint address="rest" binding="webHttpBinding" contract="IEComAPI" behaviorConfiguration="rest" bindingConfiguration="httpsbinding2"></endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"></endpoint>
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="httpbinding1">
<security mode="None"></security>
</binding>
<binding name="httpsbinding1">
<security mode="Transport">
<transport clientCredentialType="None"></transport>
</security>
</binding>
</wsHttpBinding>
<webHttpBinding>
<binding name="httpbinding2">
<security mode="None">
</security>
</binding>
<binding name="httpsbinding2">
<security mode="Transport">
<transport clientCredentialType="None"></transport>
</security>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="WCFAuthBehavior">
<serviceMetadata httpsGetEnabled="false" httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="">
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="rest">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
总结:
- 对此服务的 http web 请求 - 好的
对此服务的 http soap 请求 - 好的
对该服务的 https 网络请求 - 好的
- 对此服务的 https 肥皂请求 - 给出 404
【问题讨论】: