Sorry about that. I am extremely busy with my day job and starting my company, and dealing with my own employees. Anyhow, I can't provide a complete project because it has all of my code (IP) for my entire business. Umm I can possibly build you a new WCF service. Or, I will add the code I used, updated, etc. that I got from RabbitMQ website. You will see many functions that I used. Each function is slightly different because I was trying many variances of the connection as I could each time I copied the WCF code to the server.
As for RabbitMQ logs, nothing that I could see. I reviewed the logs and it looks like only the stuff from when I rebooted the service thinking maybe if I make a change I need to reboot the service for the change to take affect.
public async Task<string> PublishRabbitMessage(string UserName = "NeXtClient", string Password = "1")
{
try
{
var factory = new ConnectionFactory()
{
//Uri = new Uri("amqp://
NeXtClient:1...@10.1.0.6:5672/"),
HostName = "MySQL.isPlatform.local",
Port = 63672,
UserName = UserName,
Password = Password,
VirtualHost = "/%2f",
RequestedHeartbeat = DateTime.Now.AddSeconds(60) - DateTime.Now,
//Ssl =
//{
// ServerName = rabbitMqHostName,
// Enabled = false
//}
};
using (var connection = factory.CreateConnection())
using (var channel = connection.CreateModel())
{
channel.ExchangeDeclare(exchange: "logs", type: ExchangeType.Fanout);
string message = "Hello World!";
var body = Encoding.UTF8.GetBytes(message);
channel.BasicPublish(exchange: "logs",
routingKey: "",
basicProperties: null,
body: body);
return $" [x] Sent {message}";
}
}
catch(Exception e)
{
return $"Error : {e.Message}";
}
}
public async Task<string> PublishRabbitMessageVirtualHost(string UserName = "NeXtClient", string Password = "1")
{
try
{
var factory = new ConnectionFactory()
{
//Uri = new Uri("amqp://
NeXtClient:1...@10.1.0.6:5672/"),
HostName = "MySQL.isPlatform.local",
Port = 63672,
UserName = UserName,
Password = Password,
VirtualHost = "/NeXt",
RequestedHeartbeat = DateTime.Now.AddSeconds(60) - DateTime.Now,
//Ssl =
//{
// ServerName = rabbitMqHostName,
// Enabled = false
//}
};
using (var connection = factory.CreateConnection())
using (var channel = connection.CreateModel())
{
channel.ExchangeDeclare(exchange: "logs", type: ExchangeType.Fanout);
string message = "Hello World!";
var body = Encoding.UTF8.GetBytes(message);
channel.BasicPublish(exchange: "logs",
routingKey: "",
basicProperties: null,
body: body);
return $" [x] Sent {message}";
}
}
catch (Exception e)
{
return $"Error : {e.Message}";
}
}
public async Task<string> PublishRabbitMessageURI(string UserName = "NeXtClient", string Password = "1")
{
try
{
var factory = new ConnectionFactory()
{
Uri = new Uri("amqp://NeXtClient:1...@MySQL.isPlatform.local:63672/%2f"),
//HostName = "10.1.0.5",
//Port = 5672,
//UserName = UserName,
//Password = Password,
//VirtualHost = "/NeXt",
//RequestedHeartbeat = DateTime.Now.AddSeconds(60) - DateTime.Now,
//Ssl =
//{
// ServerName = rabbitMqHostName,
// Enabled = false
//}
};
using (var connection = factory.CreateConnection())
using (var channel = connection.CreateModel())
{
channel.ExchangeDeclare(exchange: "logs", type: ExchangeType.Fanout);
string message = "Hello World!";
var body = Encoding.UTF8.GetBytes(message);
channel.BasicPublish(exchange: "logs",
routingKey: "",
basicProperties: null,
body: body);
return $" [x] Sent {message}";
}
}
catch (Exception e)
{
return $"Error : {e.Message}";
}
}
public async Task<string> PublishRabbitMessageURI_2(string UserName = "NeXtClient", string Password = "11")
{
try
{
var factory = new ConnectionFactory()
{
Uri = new Uri("amqp://NeXtClient:1...@MySQL.isPlatform.local:63672/NeXt"),
//HostName = "10.1.0.5",
//Port = 5672,
//UserName = UserName,
//Password = Password,
//VirtualHost = "/NeXt",
//RequestedHeartbeat = DateTime.Now.AddSeconds(60) - DateTime.Now,
//Ssl =
//{
// ServerName = rabbitMqHostName,
// Enabled = false
//}
};
using (var connection = factory.CreateConnection())
using (var channel = connection.CreateModel())
{
channel.ExchangeDeclare(exchange: "logs", type: ExchangeType.Fanout);
string message = "Hello World!";
var body = Encoding.UTF8.GetBytes(message);
channel.BasicPublish(exchange: "logs",
routingKey: "",
basicProperties: null,
body: body);
return $" [x] Sent {message}";
}
}
catch (Exception e)
{
return $"Error : {e.Message}";
}
}