13

Access Control Service を使用して、特定のサービス ID の特定の Service Bus サブスクリプションへのアクセスを承認しています。

サブスクリプションからセッションまたはメッセージを受信すると、サービス ID が承認され、必要に応じてメッセージを受信して​​完了または破棄できます。

ただし、UnauthorizedAccessExceptionサービス ID がアクセスできないサブスクリプションにアクセスしようとしても、ルール グループがそのサービス ID に対して要求を発行せず、依存している操作を実行しようとしても、この例外が表示されません。パーティー (メッセージの送信やトピックの作成など)。

代わりに、最終的にはTimeoutException - "The timeout elapsed upon attempting to obtain a token while accessing 'https://namespace-sb.accesscontrol.windows.net/WRAPv0.9/'". 内部例外はSecurityTokenException - "The token provider was unable to provide a security token while accessing 'https://namespace-sb.accesscontrol.windows.net/WRAPv0.9/'. Token provider returned message: 'The operation has timed out'". タイムアウト例外は一時的なものと見なされるため、これは RetryPolicy に問題を引き起こします。

しかし奇妙なことにUnauthorizedAccessException、サブスクリプションの説明を受信しようとすると、 が表示されます。Rights Required for Service Bus Operationsに従って、 ...myTopic/Subscriptions/mySubscription スコープ内のリッスン クレームを持つサービス ID で使用できる必要があるもの。

私は次の設定をしています:

次の問題が発生しています。

var manager = NamespaceManager.CreateFromConnectionString("Endpoint=sb://namespace.servicebus.windows.net/;SharedSecretIssuer=testidentity;SharedSecretValue=SSdtIE5vdCBUZWxsaW5n=");
var description = manager.GetSubscription("myTopic","mySubscription");

結果として、UnauthoriszedAccessException - "The remote server returned an error: (401) Unauthorized."この例外を受け取るのではなく、説明を取得できることが期待されます。興味深いのは、これが ID がアクセスできる唯一の領域であり、UnauthorizedAccessException が表示される唯一の時間であるということです。

var subscriptions = manager.GetSubscriptions("myTopic");

タイプTimeoutExceptionの内部例外を伴う になりSecurityTokenExceptionます。ここに期待しUnauthorizedAccessExceptionます。

var client = SubscriptionClient.CreateFromConnectionString("Endpoint=sb://namespace.servicebus.windows.net/;SharedSecretIssuer=testidentity;SharedSecretValue=SSdtIE5vdCBUZWxsaW5n=", "myTopic", "otherSubscription");
var message = client.Receive()

メッセージは になりますがnull、やはり . が期待されますUnauthorizedAccessException。出力を調べると、出力ウィンドウで例外が発生していることがわかりますが、クライアントによって飲み込まれています。

A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll
A first chance exception of type 'System.TimeoutException' occurred in Microsoft.ServiceBus.dll
A first chance exception of type 'System.TimeoutException' occurred in Microsoft.ServiceBus.dll
A first chance exception of type 'System.TimeoutException' occurred in Microsoft.ServiceBus.dll
A first chance exception of type 'System.TimeoutException' occurred in Microsoft.ServiceBus.dll

同様に、トピックの作成やメッセージの送信などを試みると、TimeoutException.

サービス ID がアクセスできないレルムにアクセスしようとした場合、これは正しい動作UnauthorizedAccessExceptionでしょうか?

セットアップによって望ましい結果が得られたと思います。ID は、Listen ルールが関連付けられているサブスクリプション レルムによって識別されるサブスクリプション以外のサブスクリプションをリッスンできませんが、エラー フィードバックが明確でないことが懸念されます。継続的な再試行が発生します。

どんなアドバイスでも大歓迎です。

4

2 に答える 2

0

これらのトークンの一部には、有効期間/有効期限が制限されています。そのため、有効期限を過ぎたトークンを使用している場合、発生しているような認証エラーが発生する可能性があります。

于 2015-07-01T20:34:09.493 に答える