我已经阅读了其他服务总线相关的问题,但无法找到解决方案,所以如果这实际上是重复,那就很抱歉。
我尝试从我的工作场所代理后面连接并发布到云托管的Azure Service Bus。我知道我需要将连接模式设置为http以通过防火墙发布帖子,但是如何为namespaceManager对象提供代理服务器所需的凭据和IP以将消息发送到网络?
目前我有:
ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.Http;
// Configure Topic Settings
TopicDescription td = new TopicDescription("TestTopic");
td.MaxSizeInMegabytes = 5120;
td.DefaultMessageTimeToLive = new TimeSpan(0, 1, 0);
//Establish connection to service bus
string connectionString = CloudConfigurationManager.GetSetting("Microsoft.ServiceBus.ConnectionString");
Console.WriteLine("Setting up NamespaceManager");
var namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);
Console.WriteLine("NamespaceManager created for " + namespaceManager.Address.ToString());
Console.WriteLine("Attempting to access topic on " + namespaceManager.Address.ToString());
//Create a topic
Console.WriteLine("Creating topic");
if (!namespaceManager.TopicExists("TestTopic")) {
namespaceManager.CreateTopic(td);
Console.WriteLine("Topic created successfully");
}
else {
Console.WriteLine("Topic already exists");
}
我已经看过一些示例,但似乎没有任何代理设置应用于传出请求。提前谢谢你:)