C# 为WCF服务启用HTTPS通信。将http流量更改为https时出现问题
问题是:我试图将WCF服务流量从HTTP更改为HTTPS。但我无法访问此服务,我收到404错误。我看到一些博客说我们需要添加自定义绑定。但我不明白 请帮我做这个。 下面是默认HTTP绑定的web配置 我想将此更改为HTTPSC# 为WCF服务启用HTTPS通信。将http流量更改为https时出现问题,c#,asp.net,.net,wcf,web-config,C#,Asp.net,.net,Wcf,Web Config,问题是:我试图将WCF服务流量从HTTP更改为HTTPS。但我无法访问此服务,我收到404错误。我看到一些博客说我们需要添加自定义绑定。但我不明白 请帮我做这个。 下面是默认HTTP绑定的web配置 我想将此更改为HTTPS <system.serviceModel> <behaviors> <serviceBehaviors> <behavior> <serviceMetadata h
<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>
我在
标签下面添加了以下代码,并像冠军一样工作
<bindings>
<webHttpBinding>
<binding>
<security mode="Transport" />
</binding>
</webHttpBinding>
</bindings>
只是一个问题,但您是否在IIS中托管此服务?是的,在Azure中托管。不确定,但我认为您可以将Azure配置为在443 SSL端口上托管此服务。不过,您需要证书。如果没有证书,我可以将Web应用程序UI部分的http流量更改为https。如果只有WCF,我不能。对于WCF,我们必须需要SSL证书?我的印象是,任何其他Web应用程序(如果您使用https)也需要SSL/TSL证书。