是否可以仅使用BasicHttpBinding绑定在IIS中使用SSL和基本身份验证设置WCF服务?(我不能使用wsHttpBinding绑定)
该站点托管在IIS 7上,并设置了以下身份验证:
- Anonymous access: off
- Basic authentication: on
- Integrated Windows authentication: off !!
Run Code Online (Sandbox Code Playgroud)
服务配置:
<services>
<service name="NameSpace.SomeService">
<host>
<baseAddresses>
<add baseAddress="https://hostname/SomeService/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<endpoint address="" binding="basicHttpBinding"
bindingNamespace="http://hostname/SomeMethodName/1"
contract="NameSpace.ISomeInterfaceService"
name="Default"
/>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging …Run Code Online (Sandbox Code Playgroud) 实现通过HTTP使用WCF进行传输级安全性的Web服务非常简单:为我的WCF服务启用SSL
通过net.tcp实现与WCF一起使用传输级安全性的Web服务非常困难:具有netTcpBinding和证书传输安全性的WCF
...而net.tcp解决方案通常在服务器端和客户端都涉及到类似的东西:
<serviceCertificate
findValue="MyServiceCertificate"
storeLocation="LocalMachine"
storeName="My"
x509FindType="FindBySubjectName" />
Run Code Online (Sandbox Code Playgroud)
在HTTP情况下,您甚至不需要在客户端或服务器上提及证书.在NET.TCP案例中,您必须在我阅读的大多数源中在客户端和服务器上存储,定位和指定证书.
做神奇的事情是什么让你不必担心HTTP模式下的证书?而且,为什么在使用net.tcp时你无法使用这种魔法?