在 IIS 7(Windows Server 2008 R2)中使用带有证书身份验证的传输安全性来托管 WCF 服务
Host WCF service with Transport security with Certificate authenticating in IIS7 (Windows Server 2008 R2)
我正在尝试在 Windows Server 2008 R2 中托管使用 "Transport" 安全性和 "Certificate" 作为客户端身份验证的 WCF 服务,但出现以下错误:
"The SSL settings for the service 'SslRequireCert' does not match those of the IIS 'SslNegotiateCert'"
我在 Windows 7 中的 IIS 7.5 中托管了相同的服务,它工作正常。我无法理解我是否在这种环境中遗漏了任何东西。
这是我的 web.config:
<system.serviceModel>
<services>
<service name="TestService.TestService" behaviorConfiguration="mexBehavior">
<endpoint address="" binding="wsHttpBinding" contract="TestService.ITestService" bindingConfiguration="TestService_Client2_ITestService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="mexBehavior">
<useRequestHeadersForMetadataAddress />
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="TestService_Client2_ITestService">
<security mode="Transport">
<transport clientCredentialType="Certificate" />
</security>
</binding>
</wsHttpBinding>
以下是我在 IIS 中所做的设置:
1) 将网络服务托管为网站
2)安装服务器证书
3)启用Https并分配端口并分配证书
4) 在网站-->SSLCertificates-->Accept 中启用(也尝试使用 Accept 和 Require SSL)没有工作。
5) 应用程序池标识:.net 4.0,启用 32 位:true
在搜索此错误时,我发现了 Microsoft 的以下修补程序,它是 .net Framework 3.5.1 的一部分。所以我在 windows 服务器 2008 R2 中安装了 .net framework 3.5.1 功能,但仍然没有成功。
https://support.microsoft.com/en-us/kb/976566
目前,我 运行 没有想法,如有任何帮助,我们将不胜感激。谢谢
在我将安全模式从 "Transport" 更改为 "TransportWithMessageCredential" 并在消息层而不是传输层通过 clientAuthentication 后,它起作用了。以下是配置更改:
<binding name="TestService_Client2_ITestService">
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" />
<message clientCredentialType="Certificate"/>
</security>
</binding>
我不确定为什么,但由于某些原因,在 Windows 服务器 2008 R2 中,通过传输层传递证书不起作用(或者)可能有一个设置需要打开。很高兴知道根本原因。
我正在尝试在 Windows Server 2008 R2 中托管使用 "Transport" 安全性和 "Certificate" 作为客户端身份验证的 WCF 服务,但出现以下错误:
"The SSL settings for the service 'SslRequireCert' does not match those of the IIS 'SslNegotiateCert'"
我在 Windows 7 中的 IIS 7.5 中托管了相同的服务,它工作正常。我无法理解我是否在这种环境中遗漏了任何东西。
这是我的 web.config:
<system.serviceModel>
<services>
<service name="TestService.TestService" behaviorConfiguration="mexBehavior">
<endpoint address="" binding="wsHttpBinding" contract="TestService.ITestService" bindingConfiguration="TestService_Client2_ITestService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="mexBehavior">
<useRequestHeadersForMetadataAddress />
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="TestService_Client2_ITestService">
<security mode="Transport">
<transport clientCredentialType="Certificate" />
</security>
</binding>
</wsHttpBinding>
以下是我在 IIS 中所做的设置:
1) 将网络服务托管为网站 2)安装服务器证书 3)启用Https并分配端口并分配证书 4) 在网站-->SSLCertificates-->Accept 中启用(也尝试使用 Accept 和 Require SSL)没有工作。 5) 应用程序池标识:.net 4.0,启用 32 位:true
在搜索此错误时,我发现了 Microsoft 的以下修补程序,它是 .net Framework 3.5.1 的一部分。所以我在 windows 服务器 2008 R2 中安装了 .net framework 3.5.1 功能,但仍然没有成功。
https://support.microsoft.com/en-us/kb/976566
目前,我 运行 没有想法,如有任何帮助,我们将不胜感激。谢谢
在我将安全模式从 "Transport" 更改为 "TransportWithMessageCredential" 并在消息层而不是传输层通过 clientAuthentication 后,它起作用了。以下是配置更改:
<binding name="TestService_Client2_ITestService">
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" />
<message clientCredentialType="Certificate"/>
</security>
</binding>
我不确定为什么,但由于某些原因,在 Windows 服务器 2008 R2 中,通过传输层传递证书不起作用(或者)可能有一个设置需要打开。很高兴知道根本原因。