【发布时间】:2013-07-12 00:34:50
【问题描述】:
我正在尝试从本地工作组计算机(Windows 7)(称为“客户端”)向设置在工作组服务器(托管在 AWS EC2 上)上的 Service Bus 1.0 发送和接收消息。经过多次试验和研究,我无法将消息从客户端机器发送到服务器。我关注了许多似乎表明可以这样做的文章,但我无法解决我看到的身份验证问题。
Connecting to Windows Server Service Bus on AWS
Microsoft Service Bus on a Windows Workgroup
我注意到 Microsoft 系统要求似乎表明它“不受支持”和“不可能”。我的问题是这可以做到吗,有人成功了吗?任何帮助将不胜感激。
msdn.microsoft.com/en-us/library/windowsazure/jj193011(v=azure.10).aspx
我的尝试包括使用 WindowsTokenProvider 和 OAuthTokenProvider。我得到相同的结果:
System.UnauthorizedAccessException:令牌提供程序在访问“https://xx.xx.xx.xx:9355/ServiceBusDefaultNamespace/$STS/Windows/”时无法提供安全令牌。令牌提供程序返回消息:''。 ---> System.IdentityModel.Tokens.SecurityTokenException:令牌提供程序在访问“https://xx.xx.xx.xx:9355/ServiceBusDefaultNamespace/$STS/Windows/”时无法提供安全令牌。令牌提供程序返回消息:''。 ---> System.Net.WebException: 远程服务器返回错误: (401) Unauthorized.
使用 AddressingScheme“路径”为工作组安装设置服务总线命名空间。并且客户端连接字符串包括到达服务器的 IP,并且我在创建队列之前设置了 RemoteCertificateValidationCallback。
Endpoint=sb://xx.xx.xx.xx/ServiceBusDefaultNamespace;StsEndpoint=https://xx.xx.xx.xx:9355/ServiceBusDefaultNamespace;RuntimePort=9354;ManagementPort=9355;WindowsUsername=SBUser;WindowsDomain=[NotUsed];WindowsPassword=[Password]
附加到远程队列并发送消息的代码如下:
ServiceBusConnectionStringBuilder connBuilder = new ServiceBusConnectionStringBuilder(ConfigurationManager.AppSettings["Microsoft.ServiceBus.ConnectionString"]); // Gets the connection string above
TokenProvider tokenProvider = WindowsTokenProvider.CreateWindowsTokenProvider(connBuilder.StsEndpoints, new NetworkCredential(connBuilder.WindowsCredentialUsername, connBuilder.WindowsCredentialPassword));
MessagingFactorySettings messagingFactorySettings = new MessagingFactorySettings();
messagingFactorySettings.TokenProvider = tokenProvider;
MessagingFactory messagingFactory = MessagingFactory.Create(connBuilder.GetAbsoluteRuntimeEndpoints(), messagingFactorySettings);
requestQueue = messagingFactory.CreateQueueClient("RequestQueue");
...
requestQueue.Send(sendMessage); // Fails here
服务器帐户是带有密码的 SBUser,我在令牌提供程序上将指定的域/主机留空。我注意到服务器上的事件查看器显示正在尝试的身份验证是客户端的用户帐户,而不是来自令牌提供者的用户帐户。为什么是这样?为了在服务器上进行身份验证,我显然遗漏了一些东西。
An account failed to log on.
Subject:
Security ID: NULL SID
Account Name: -
Account Domain: -
Logon ID: 0x0
Logon Type: 3
Account For Which Logon Failed:
Security ID: NULL SID
Account Name: [ClientLogin]
Account Domain: [ClientMahcine]
Failure Information:
Failure Reason: Unknown user name or bad password.
Status: 0xc000006d
Sub Status: 0xc0000064
感谢任何帮助。谢谢。
【问题讨论】:
标签: amazon-web-services servicebus