Per*_*Per 4 nservicebus azure azureservicebus azure-appservice
我在 Azure 中将此应用程序服务作为 Web 作业运行。该应用程序是使用 NServiceBus 构建的前 Windows 服务,我一直在重新配置它以在 Azure 中工作。
该应用程序正在使用 AzureServiceBusTransport,并且我的 Azure 服务总线设置了队列。
我得到它的工作......当我使用在我的连接字符串中配置的共享访问密钥时,如下所示;
"ConnectionString": "Endpoint=sb://MYNAMESPACE.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=***"
Run Code Online (Sandbox Code Playgroud)
为了使其与托管身份一起使用,我在 NServiceBus EndpointConfiguration 中重新配置了:
transport.CustomTokenCredential(new DefaultAzureCredential());
Run Code Online (Sandbox Code Playgroud)
我还将连接字符串更改为以下内容;
"ConnectionString": "Endpoint=sb://MYNAMESPACE.servicebus.windows.net/;Authentication=ManagedIdentity"
Run Code Online (Sandbox Code Playgroud)
但是当我尝试使用托管身份时,我收到以下异常;
ArgumentException:值“Endpoint=sb://MYNAMESPACE.servicebus.windows.net/;Authentication=ManagedIdentity”不是格式良好的服务总线完全限定命名空间。
当我使用共享访问密钥时,MYNAMESPACE 显然是正确的,但当我使用托管身份时却不正确?
我们确实有一个可以使用托管身份的 Azure 功能,并且在这种情况下使用:
"ConnectionString": "Endpoint=sb://MYNAMESPACE.servicebus.windows.net/;Authentication=ManagedIdentity"
Run Code Online (Sandbox Code Playgroud)
刚刚在 NServiceBus 上遇到了同样的问题。代替:
"ConnectionString": "Endpoint=sb://MYNAMESPACE.servicebus.windows.net/;Authentication=ManagedIdentity"
Run Code Online (Sandbox Code Playgroud)
只需设置:
"ConnectionString": "MYNAMESPACE.servicebus.windows.net"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6602 次 |
| 最近记录: |