跨服务器和 WCF 的证书



我在一台服务器上运行了一个网站、WCF 服务和安全令牌服务 (STS(。 一切都很好。 我现在正在尝试跨服务器分离各个部分。 当网站尝试登录以获取令牌时,我收到 ssl 证书错误。

当我调试时,这将在Server 2008和IIS 7.5以及我的Windows 7 IIS 7.5上。

An error occurred while making the HTTP request to https://x.x.x.x/STS/issue/wstrust/mixed/username. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by...

我在 STS 服务器上生成了一个自签名证书,并将其导出到网站服务器。 我还导出了密钥,并授予IIS对网站服务器上密钥的访问权限。 这通过了一堆WIF错误,它不会运行,但我不确定这是正确的做法。

我也尝试过[netsh http add sslcert ipport:0.0.0.0:44400 ect...] 但是我不确定要使用哪个端口,我尝试了六个不同的端口,但似乎都不起作用,而 443 也不起作用。

该网站正在使用WSTrustChannelFactory来创建连接。 它会轰炸底部的 channel.issue 命令。

 var factory = new WSTrustChannelFactory(
                 new UserNameWSTrustBinding(SecurityMode.TransportWithMessageCredential),
                 new EndpointAddress(signInEndpoint));
             factory.TrustVersion = TrustVersion.WSTrust13;
             factory.Credentials.UserName.UserName = userName;
             factory.Credentials.UserName.Password = password;
             var channel = factory.CreateChannel();
             var rst = new RequestSecurityToken
             { 
                 RequestType = RequestTypes.Issue,
                 AppliesTo = new EndpointAddress(realm),
                 KeyType = KeyTypes.Bearer
             };

             try
             {
                 var genericToken = channel.Issue(rst) as GenericXmlSecurityToken;

**编辑**

我还设置了网站服务器 IIS 默认网站 https 绑定端口 443 以使用我从 STS 服务器导入的证书并收到相同的错误。

**

结束编辑 **

我一直在谷歌和stackoverflow上,虽然许多问题似乎很接近,但没有一个批准的答案奏效。

想法? 我是服务器/硬件菜鸟,所以"傻瓜版本"会很好。

谢谢!

由于您使用的是自签名证书,因此请确保关闭证书链验证或将其添加到受信任的存储区。看起来您正在使用 IdentityServer 的 url,在那里您可以关闭强端点要求,并在客户端上使用仅具有消息安全性的 UserNameWSTrustBinding。

最新更新