【发布时间】:2019-02-08 10:43:40
【问题描述】:
问题是: 我尝试将 WCF 服务流量从 HTTP 更改为 HTTPS。但我无法访问此服务,我收到 404 错误。我看到一些博客说我们需要添加自定义绑定。但我没有。
请帮帮我。 下面是我的默认 HTTP 绑定的 Web 配置。
我希望将其更改为 HTTPS。
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior>
<webHttp helpEnabled="True" />
</behavior>
</endpointBehaviors>
</behaviors>
<protocolMapping>
<add binding="webHttpBinding" scheme="http" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<directoryBrowse enabled="true" />
<httpProtocol>
</httpProtocol>
</system.webServer>
【问题讨论】:
-
只是一个问题,但是您是否在 IIS 中托管此服务?
-
是在 Azure 中托管。
-
不确定,但我认为您可以配置 azure 以在 443 SSL 端口上托管服务。不过你需要一个证书。
-
在没有证书的情况下,我可以将 Web 应用程序 UI 部分的 http 流量更改为 https。仅在 WCF 的情况下,我无法做到。对于 WCF,我们必须需要 SSL 证书吗?
-
我的印象是任何其他 Web 应用程序也需要 SSL/TSL 证书(如果您使用的是 https)。
标签: c# asp.net .net wcf web-config