2014-09-09 22 views
13

Tôi đang sử dụng Dịch vụ kiểm soát truy cập để cho phép truy cập vào Đăng ký dịch vụ cụ thể cho các Danh tính dịch vụ cụ thể.Hoạt động của dịch vụ xe buýt Azure Tăng thời gian chờ ngoại lệ thay vì UnauthorizedAccessException bằng ACS

Khi nhận phiên hoặc tin nhắn từ đăng ký, Danh tính dịch vụ được ủy quyền và có thể nhận và hoàn thành hoặc hủy tin nhắn theo yêu cầu.

Tuy nhiên, tôi không nhìn thấy một UnauthorizedAccessException khi cố gắng truy cập vào một thuê bao Identity Service không có quyền truy cập vào, cũng không phải tôi nhìn thấy ngoại lệ này khi cố gắng thực hiện một hoạt động mà Tập đoàn Quy tắc không đưa ra khiếu nại để cho Bên nhận dạng và bên nhận dịch vụ (chẳng hạn như Gửi tin nhắn hoặc tạo chủ đề).

Thay vào đó, cuối cùng tôi thấy một số TimeoutException - "The timeout elapsed upon attempting to obtain a token while accessing 'https://namespace-sb.accesscontrol.windows.net/WRAPv0.9/'". Ngoại lệ bên trong là 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'". Điều này gây ra một vấn đề cho RetryPolicy, vì một Timeout Exception được coi là thoáng qua.

Thật lạ, mặc dù, tôi nhận được UnauthorizedAccessException khi cố gắng nhận Mô tả đăng ký. Nội dung nào đó, theo số Rights Required for Service Bus Operations, sẽ có sẵn cho Danh tính dịch vụ với Tuyên bố nghe trong phạm vi ... myTopic/Đăng ký/phạm vi đăng ký của tôi.

Tôi đã sau đây thiết lập:

Tôi nhìn thấy những vấn đề sau:

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

Kết quả trong một UnauthoriszedAccessException - "The remote server returned an error: (401) Unauthorized." tôi mong chờ để có thể lấy mô tả, chứ không phải là nhận ngoại lệ này. Điều thú vị là đây là lĩnh vực duy nhất mà danh tính có quyền truy cập, và là lần duy nhất tôi thấy một UnauthorizedAccessException.

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

Kết quả trong một TimeoutException, với ngoại lệ bên trong loại SecurityTokenException. Tôi mong đợi một số UnauthorizedAccessException tại đây.

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

Kết quả trong thông điệp là null, nhưng một lần nữa tôi mong chờ một UnauthorizedAccessException. Kiểm tra đầu ra, tôi thấy trường hợp ngoại lệ xảy ra trong cửa sổ đầu ra nhưng bị nuốt chửng bởi khách hàng:

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 

Tương tự như vậy, cố gắng tạo chủ đề, gửi tin nhắn, vv cũng dẫn đến một TimeoutException.

Đây có phải là hành vi đúng khi cố gắng truy cập các cõi mà nhận dạng dịch vụ không có quyền truy cập vào, thay vì mong đợi của tôi khi nhận được UnauthorizedAccessException?

Tôi đoán các thiết lập không có kết quả mong muốn - bản sắc không thể lắng nghe thuê bao khác so với cái (s) xác định bởi các lĩnh vực thuê bao dựa vào đó bản sắc có một quy tắc Nghe có liên quan, nhưng tôi lo ngại rằng những phản hồi lỗi không rõ ràng và sẽ dẫn đến việc thử lại liên tục.

Mọi lời khuyên sẽ được đánh giá cao nhất.

Trả lời

1

Các vùng tên SB mới được tạo sau 8/22 qua cổng Azure không tạo ra các không gian tên ACS đồng hành nữa. Vì vậy, hoàn toàn có thể là thời gian chờ bạn nhận được là hành vi chính xác.

Để tạo không gian tên ACS, hãy thử tạo không gian tên SB bằng cách sử dụng lệnh ghép ngắn PowerShell mới của Azure.

+1

Trong khi đây là thông tin hữu ích, thì không gian tên ACS đi kèm tồn tại. Nếu không, tôi sẽ không thể thiết lập danh tính dịch vụ, dựa vào các bên hoặc nhóm quy tắc. Tôi đã xác nhận bằng cách sử dụng giao diện người dùng web và thiết lập quyền truy cập bằng cách sử dụng API theo lập trình. Nếu họ không tồn tại, tôi sẽ không thể làm được điều này. Cảm ơn tất cả như nhau, mặc dù. – GaryJL

0

Một số mã thông báo này có thời lượng giới hạn/hết hạn. Vì vậy, nếu bạn đang sử dụng một mã thông báo cho rằng đã vượt qua nó hết hạn có thể dẫn đến một lỗi ủy quyền như bạn đang gặp phải.

Các vấn đề liên quan