问题是:我尝试将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>
我在<behaviors>
标签下添加了以下代码,并像冠军一样工作。
<bindings>
<webHttpBinding>
<binding>
<security mode="Transport" />
</binding>
</webHttpBinding>
</bindings>