我遇到了让 wss:// 在生产中使用 3.06 版的问题。
我已经能够让它在本地的测试环境中工作(见最后的测试环境设置)。
如果我使用 ws:// 而不是 wss://,则生产服务器可以工作
在生产中出现以下错误:net::ERR_CONNECTION_REFUSED
(注意:当我使用 ws:// 时,我已经将我的测试网站切换到 http:// 而不是 https://
生产环境:
- 2 个运行 Web 应用程序的独立 Web 服务器(负载平衡)
- 1 个运行 XSockets v3.06 的独立服务器(作为 Windows 服务)
- 所有服务器都在一个子域中:
一个。网络服务器:web1.acme.com b. Xsocket 服务器:commbus.acme.com
(注意:我这里没有显示真实域名(acme))
- 所有服务器都使用相同的通配符证书“cn=*.acme.com”</li>
- 所有服务器都在防火墙后面。
我尝试使用具有以下不同构造函数的 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) 公共 SecureConfig() : base(new Uri("wss://commbus.acme.com:4502"), new 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”</p>
如果我在 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";
}
我不确定我错过了什么。