我有一个 WCF (svs) Web 服务,它在 Windows 2008 IIS Web 服务器上运行。
IIS 服务器已安装 SSL 证书,并通过 HTTP 和 HTTPS 托管 Classic ASP 和 PHP。
我已经将 WCF 服务作为应用程序安装在 IIS 服务器上(在同一个域上),它可以完美地使用 HTTP 和 HTTPS 服务请求。
但是,我希望这个 WCF 服务只提供 HTTPS 请求和响应。
为了实现这一点,我需要在 WCF web.config 中进行哪些更改?
更新
继我上面的帖子之后,我设法研究了以下似乎可以使用 web.config 文件工作的内容;
<system.serviceModel>
<services>
<service behaviorConfiguration="returnFaults" name="MyService.MonitorService">
<endpoint binding="wsHttpBinding" bindingConfiguration=
"TransportSecurity" contract="MyService.IMonitorSvc" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="returnFaults">
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="TransportSecurity">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
谁能确认这是 WCF 服务的正确方法,强制所有请求都通过 HTTPS (SSL) 发出?
基本上使用上述内容,用户是否能够向服务发出 HTTP 请求?或者该服务是否总是强制执行 HTTPS
感谢您的澄清。