2012-04-27 111 views
1

我有一个网站,wcf服务和一台服务器上运行的安全令牌服务(STS)。一切都很好。我现在正试图在服务器之间分离彼此。当网站登录获取令牌时,我会收到ssl证书错误。跨服务器和WCF的证书

这将是在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服务器导入证书,并得到了同样的错误。

**完**编辑

我已经遍布谷歌和计算器,虽然许多问题似乎接近,没有批准的答案都工作过。

想法?我是一个服务器/硬件noob所以“傻瓜版”会很好。

谢谢!

+0

难道它没有工作的原因是,我的笔记本电脑是不是在iis服务器相同的域? – William 2012-04-30 15:46:55

+0

我遇到同样的问题,试图使用IdentityServer的API调用。你有没有解决这个问题?当IdentityServer与客户端在同一台计算机上运行时,我们遇到此问题,并在Trusted CA根中使用自签名证书。 – Tim 2013-02-22 16:36:25

回答

0

由于您使用的是自签名证书,请务必关闭Certificate Chain Validation或将其添加到可信存储区。它看起来像你使用IdentityServer的URL,在那里你可以关闭强大的端点需求,并在客户端使用UserNameWSTrustBinding只有消息安全。

+0

我会试试看,谢谢! – William 2012-05-17 17:04:52

+0

我没有尝试这个建议,但我理解链验证的需要,并且是正确的方向。 – William 2014-01-01 21:10:31