gpt4 book ai didi

wcf - 通过 SSL 为 IIS6 配置 WCF 传输安全

转载 作者:太空宇宙 更新时间:2023-11-03 13:56:10 24 4
gpt4 key购买 nike

我一直在尝试在 IIS6 上使用 SSL 设置 WCF 传输安全。

客户端位于同一域中的单独计算机上。

我了解证书、根 CA 等的前提,并且有一套用于消息安全的工作证书,并且可以在相同的环境设置中使用这些无问题。 (上周我没学到很多 :)

当我将 IIS 6 服务切换到 SSL 时,我一直在努力让我的客户端针对 IIS 6 服务进行身份验证。调用时总是收到“不允许匿名身份验证”。

在 IIS 中我有

  • 在站点上为 SSL 端口 443 设置的根签名 CA 证书(如果我浏览 https://svc 页面,我可以看到 IE 挂锁,并且该页面显示您需要证书才能进行通信)

我有安全通信

  • 需要 SSL channel
  • 需要 128 位加密
  • 需要客户证书
  • 启用客户端证书映射(设置多对一映射到 IIS 框上的管理员帐户,现在在证书主题 O 字段上匹配)

在网站安全(身份验证和访问控制)下

  • 匿名访问 = ON
  • 集成 Windows 身份验证 = 关闭
  • 基本身份验证 = ON

对于客户端 wsHttpBinding,我有一个准备好进行身份验证的证书和一个自定义端点行为来提供此信息,但我认为它还没有走到这一步!

更新的服务器配置

<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="CertificateWithTransport">
<security mode="Transport">
<transport clientCredentialType="Certificate"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="WCFServiceCertificate.Service1" behaviorConfiguration="credentialConfig">
<endpoint address="https://svnvmig02/Service1.svc"
binding="wsHttpBinding"
bindingConfiguration="CertificateWithTransport"
contract="WCFServiceCertificate.IService1">
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="credentialConfig">
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="false"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>

更新的客户端配置

<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IService1">
<security mode="Transport">
<transport clientCredentialType="Certificate" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://svnvmig02/Service1.svc" binding="wsHttpBinding" behaviorConfiguration="CustomBehavior"
bindingConfiguration="WSHttpBinding_IService1" contract="ServiceReference1.IService1"
name="WSHttpBinding_IService1">
</endpoint>
</client>
<behaviors>
<endpointBehaviors>
<behavior name="CustomBehavior">
<clientCredentials>
<clientCertificate findValue="svnvmig02" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My"/>
<serviceCertificate>
<authentication certificateValidationMode="PeerTrust"/>
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>

编辑:可能值得一提的是,我的 VS 项目是 3.5,但 IIS6 正在运行 .net4

通过修改后的配置(感谢 Fabio ;)我现在可以在 IE 浏览器中浏览地址 https://svnvmig01/Service1.svc从客户端计算机查看生成的 svc 页面,它允许我单击也可用的 wsdl URl。

我在网上找到的大部分页面都涉及自托管或 IIS7....我希望 IIS7 支持更好;)

任何帮助将不胜感激:)

最佳答案

您的配置包括:

https://svnvmig02:8091/Service1.svc

ssl 的正常端口是 443。

请求可能没有到达您期望的站点。因此,您会收到意外的错误消息。

检查 IIS 日志以确保哪个站点正在接收请求。

关于wcf - 通过 SSL 为 IIS6 配置 WCF 传输安全,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6506266/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com