【发布时间】:2014-10-18 01:29:11
【问题描述】:
我在让 wss:// 在生产中使用 3.06 版时遇到了问题。
我已经能够让它在本地的测试环境中工作(见最后的测试环境设置)。
如果我使用 ws:// 而不是 wss://,生产服务器可以工作
在生产中我收到以下错误:net::ERR_CONNECTION_REFUSED
(注意:当我使用 ws:// 时,我已将我的测试网站切换为 http:// 而不是 https://
生产环境:
- 2 个独立的 Web 服务器运行一个 Web 应用程序(负载平衡)
- 1 个运行 XSockets v3.06(作为 Windows 服务)的独立服务器
- 所有服务器都在一个子域中:
一个。网络服务器:web1.acme.com 湾。 Xsocket 服务器:commbus.acme.com
(注意:我这里没有显示真实域名(acme))
- 所有服务器都使用相同的通配符证书“cn=*.acme.com”
- 所有服务器都位于防火墙后面。
我尝试使用具有以下不同构造函数的 ConfigurationSettings 类: (注:192.168.1.1 不是我们使用的真实内部 IP,但它是相似的)
1) 我使用这个选项是因为它在测试环境中工作
public class SecureConfig : ConfigurationSetting
{
public SecureConfig()
: base()
{}
}
2)
public SecureConfig()
: base(new Uri("wss://commbus.acme.com:4502"), new Uri("wss://192.168.1.1:4502"))
{
this.CertificateLocation = StoreLocation.LocalMachine;
this.CertificateSubjectDistinguishedName = "cn=*.acme.com";
}
3) 公共安全配置() : 基础(新 Uri("wss://commbus.acme.com:4502"), 新 Uri("wss://192.168.1.1:4502")) {
4)
public SecureConfig()
: base(new Uri("wss://commbus.acme.com:4502")
{}
5)
public SecureConfig()
: base(new Uri("wss://commbus.acme.com:4502")
{
this.CertificateLocation = StoreLocation.LocalMachine;
this.CertificateSubjectDistinguishedName = "cn=*.acme.com";
}
测试环境:
验证我是否可以设置 wss://。我已经能够进行以下测试:
1) 使用 HTTPS 在本地运行 IIS Express 2) 在控制台应用程序中运行 XSockets 代码
(注意:所有 XSockets 代码都在一个单独的库程序集中,并且我的测试控制台应用程序和生产中都使用了同一个库程序集)
3) 对于测试,我使用了证书“cn=localhost”
如果我在 ConfiguationSetting 类中使用以下内容,则效果很好:
public class SecureConfig : ConfigurationSetting
{
public SecureConfig()
: base()
{
}
}
我注意到测试站点的行为:
如果我对 ConfigurationSettings 类使用以下构造函数,我会在生产中遇到同样的错误:
public SecureConfig()
: base(new Uri("wss://localhost:4502"))
{
}
或者
public SecureConfig()
: base(new Uri("wss://localhost:4502"))
{
this.CertificateLocation = StoreLocation.LocalMachine;
this.CertificateSubjectDistinguishedName = "cn=local";
}
我不确定我错过了什么。
【问题讨论】: