当我访问我的网络服务 localhost/MyService/MyService.svc 时出现以下错误
服务“SslRequireCert”的 SSL 设置与 IIS“Ssl,SslNegotiateCert”的设置不匹配。
我遵循http://msdn.microsoft.com/en-us/library/ms731074.aspx中指定的 web.config 示例
这是我的 wcf 服务器 web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings />
<system.web>
<identity impersonate="false" />
<roleManager enabled="true" />
<authentication mode="Windows" />
<customErrors mode="Off" />
<webServices>
<protocols>
<add name="HttpGet" />
<add name="HttpPost" />
</protocols>
</webServices>
</system.web>
<system.webServer>
<directoryBrowse enabled="true" />
<validation validateIntegratedModeConfiguration="false" />
<security>
<authorization>
<remove users="*" roles="" verbs="" />
<add accessType="Allow" users="*" roles="" />
</authorization>
</security>
</system.webServer>
<system.serviceModel>
<services>
<service name="AspNetSqlProviderService" behaviorConfiguration="MyServiceBehavior">
<endpoint binding="wsHttpBinding" contract="Interface1" bindingConfiguration="CertificateWithTransportWSHttpBinding" />
<endpoint binding="wsHttpBinding" contract="Interface2" bindingConfiguration="CertificateWithTransportWSHttpBinding" />
<endpoint address="mex" binding="wsHttpBinding" bindingConfiguration="CertificateWithTransportWSHttpBinding" name="Metadata_Exchange" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<serviceDebug includeExceptionDetailInFaults="True" />
<serviceMetadata />
<serviceCredentials>
<clientCertificate>
<authentication trustedStoreLocation="LocalMachine"
revocationMode="Online"/>
</clientCertificate>
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="CertificateWithTransportWSHttpBinding">
<security mode="Transport">
<transport clientCredentialType="Certificate" />
</security>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
</configuration>
我已将 IIS 配置如下:
- 使用自签名证书添加的 https 绑定
- 在 SSL 设置下,选中需要 SSL 并接受客户端证书
- 自签名证书已添加到本地计算机受信任的根 CA。
我可以浏览并执行 .asmx 服务定义,但 .svc 给了我上述错误。