我在 Azure 中將此應用服務作為 Web 作業運行。該應用程式是使用 NServiceBus 構建的前 Windows 服務,我一直在重新配置它以在 Azure 中作業。
該應用程式使用 AzureServiceBusTransport,我的 Azure 服務總線設定了佇列。
我讓它作業了......當我使用像這樣在我的連接字串中配置的共享訪問密鑰時;
"ConnectionString": "Endpoint=sb://MYNAMESPACE.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=***"
為了使其與托管標識一起使用,我在 NServiceBus EndpointConfiguration 中重新配置了;
transport.CustomTokenCredential(new DefaultAzureCredential());
我還將我的連接字串更改為以下內容;
"ConnectionString": "Endpoint=sb://MYNAMESPACE.servicebus.windows.net/;Authentication=ManagedIdentity"
但是,當我嘗試使用托管標識時,出現以下例外;
ArgumentException:值 'Endpoint=sb://MYNAMESPACE.servicebus.windows.net/;Authentication=ManagedIdentity' 不是格式正確的服務總線完全限定命名空間。
當我使用共享訪問密鑰時 MYNAMESPACE 顯然是正確的,但當我使用托管標識時卻不是?
我們確實有一個可以使用托管標識的 Azure 函式,在這種情況下正在使用;
"ConnectionString": "Endpoint=sb://MYNAMESPACE.servicebus.windows.net/;Authentication=ManagedIdentity"
uj5u.com熱心網友回復:
剛剛在 NServiceBus 上遇到了同樣的問題。代替:
"ConnectionString": "Endpoint=sb://MYNAMESPACE.servicebus.windows.net/;Authentication=ManagedIdentity"
只需設定:
"ConnectionString": "MYNAMESPACE.servicebus.windows.net"
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/351484.html
標籤:天蓝色 天蓝色服务总线 服务总线 azure-appservice
