我有几个Windows服务实例在同一个服务总线主机中访问自己的命名空间。但是最近大多数服务在尝试使用服务总线时都会出现奇怪的错误(每个服务启动时的第一个点就是为自己创建一个主题)。但我仍然能够通过servicebus explorer使用相同的连接来手动访问相同的命名空间。
我在事件查看器中看到了几个错误,如:
MessagingEntityAlreadyExistsException
Microsoft.ServiceBus.Messaging.MessagingEntityAlreadyExistsException: The remote server returned an error: (409) Conflict. SubCode=40900. Conflict.TrackingId:357526f0-1635-4e16-bcf0-d1c963d65184_GWIN-NKD9IS8A8GG,TimeStamp:4/8/2016 10:07:59 AM ---> System.Net.WebException: The remote server returned an error: (409) Conflict.
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at Microsoft.ServiceBus.Messaging.ServiceBusResourceOperations.CreateOrUpdateAsyncResult`1.<GetAsyncSteps>b__14(CreateOrUpdateAsyncResult`1 thisPtr, IAsyncResult r)
at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result)
--- End of inner exception stack trace ---
at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
at AFT.RegoV2.RegoBus.Bus.WindowsServiceBus.<>c__DisplayClass24_0.<EnsureTopicExists>b__0() in C:\TeamCity\buildAgent3\work\218e2fa0847c410\RegoBus\Bus\WindowsServiceBus.cs:line 263
at AFT.RegoV2.Shared.Synchronizatio...
但我100%确定该命名空间中没有主题。我检查了连接字符串,检查了命名空间,在它之前手动删除它等等。
下一个是:
Security Token Service warning: System.DirectoryServices.AccountManagement.PrincipalServerDownException: The server could not be contacted. ---> System.DirectoryServices.Protocols.LdapException: The LDAP server is unavailable.
at System.DirectoryServices.Protocols.LdapConnection.Connect()
at System.DirectoryServices.Protocols.LdapConnection.SendRequestHelper(DirectoryRequest request, Int32& messageID)
at System.DirectoryServices.Protocols.LdapConnection.SendRequest(DirectoryRequest request, TimeSpan requestTimeout)
at System.DirectoryServices.AccountManagement.PrincipalContext.ReadServerConfig(String serverName, ServerProperties& properties)
--- End of inner exception stack trace ---
at System.DirectoryServices.AccountManagement.PrincipalContext.ReadServerConfig(String serverName, ServerProperties& properties)
at System.DirectoryServices.AccountManagement.PrincipalContext.DoServerVerifyAndPropRetrieval()
at System.DirectoryServices.AccountManagement.PrincipalContext..ctor(ContextType contextType, String name, String container, ContextOptions options, String userName, String password)
at System.DirectoryServices.AccountManagement.PrincipalContext..ctor(ContextType contextType)
at Microsoft.Cloud.ServiceBus.Common.Security.SecurityExtensions.IsDomainController()
at Microsoft.Cloud.ServiceBus.Common.Security.SecurityExtensions.TryOrDefault[T](Func`1 func, Boolean trace)
但奇怪的是,我可以从日志或调试中获取连接字符串,并通过Servicebus Explorer自由连接到服务总线。同时,服务无法使用相同的字符串进行连接。
第三个是:
TrackingId: f5bb8bfe-a5c2-4b86-b982-4beaca4defba, SubsystemId: NoSystemTracker, Gateway: Management resource manifest is marked as broken. Details: Cleanup: Set State = 'Broken' for 1 resources
我试了谷歌所有人,尝试了我能找到的所有收据,但仍然没有运气。具体而言,我试过:
- )重新启动servicebus farm
- )重新启动安装了servicebus的整个服务器
- )使用我们的部署脚本手动删除和创建命名空间
- )尝试了oauth和win方式认证
- )两种可用的传输类型(amqp和netmessaging)
用于创建主题的服务代码:
using (var scope = CustomTransactionScope.GetTransactionSuppressedScope())
{
_syncService.Execute("WindowsServiceBus_" + topicName, () =>
{
var namespaceManager = GetNamespaceManager();
if (!namespaceManager.TopicExists(topicName))
{
var topicDescription = new TopicDescription(topicName);
namespaceManager.CreateTopic(topicDescription);
}
});
scope.Complete();
}
_syncService只是一种确保此方法仅在每个主题的一个线程中执行的方法
非常感谢任何建议。