private void test1()
{
string path = System.Windows.Forms.Application.StartupPath;
path += "\\client-1026.p12"; var factory = new ConnectionFactory();
factory.HostName = "192.168.194.75"; //ConfigurationManager.AppSettings["192.168.194.75"]; // factory.AuthMechanisms = new AuthMechanismFactory[] { new ExternalMechanismFactory() };
// Note: This should NEVER be "localhost"
factory.Ssl.ServerName = "192.168.194.75"; //ConfigurationManager.AppSettings["rabbit@USER-20160918AJ"];
// Path to my .p12 file.
factory.Ssl.CertPath = path;// ConfigurationManager.AppSettings[path];
// Passphrase for the certificate file - set through OpenSSL
factory.Ssl.CertPassphrase = "123456";// ConfigurationManager.AppSettings["123456"];
factory.Ssl.Enabled = true;
// Make sure TLS 1.2 is supported & enabled by your operating system
factory.Ssl.Version = SslProtocols.Tls;
// This is the default RabbitMQ secure port
factory.Port = 5671;
factory.VirtualHost = "/";
factory.UserName = "wubb";
factory.Password = "123456";
// Standard RabbitMQ authentication (if not using ExternalAuthenticationFactory)
//factory.UserName = ConfigurationManager.AppSettings["rabbitmqUsername"];
//factory.Password = ConfigurationManager.AppSettings["rabbitmqPassword"];
using (var connection = factory.CreateConnection())
{
using (var channel = connection.CreateModel())
{
// publish some messages...
}
}
}总是提示Endpoint无法到达。不知道哪个地方出了问题。
上面用的是我的局域网服务器
另外: factory.Ssl.ServerName 这个到底指的是什么,是指IP吗
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货