跨服务器和WCF的证书

时间:2012-04-27 15:19:54

标签: wcf iis certificate ssl-certificate wif

我在一台服务器上运行了网站,wcf服务和安全令牌服务(STS)。一切都很好。我现在正试图在服务器之间分离peices。当网站尝试登录以获取令牌时,我会收到ssl cert错误。

这将是在我调试时在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等...]但是我不确定要使用哪个端口,香港专业教育学院尝试了六个不同的端口,似乎没有工作,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服务器导入的证书并获得相同的错误。

**结束编辑**

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

想法?我是服务器/硬件菜鸟所以“for dummies版本”会很好。

谢谢!

1 个答案:

答案 0 :(得分:0)

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

相关问题