NserviceBus配置中指定的Azure存储队列连接字符串在哪里?

时间:2015-07-08 09:59:46

标签: .net azure nservicebus

使用AzureStorageQueueTransport时,我收到错误消息:

System.Collections.Generic.KeyNotFoundException: The given key (NServiceBus.LocalAddress) was not present in the dictionary.
   at NServiceBus.Settings.SettingsHolder.Get(String key) in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Settings\SettingsHolder.cs:line 91
   at NServiceBus.Settings.SettingsHolder.Get[T](String key) in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Settings\SettingsHolder.cs:line 23
   at NServiceBus.Azure.Transports.WindowsAzureStorageQueues.AzureQueueNamingConvention.<.cctor>b__0(ReadOnlySettings settings) in c:\BuildAgent\work\4e5353dd260f0a07\src\Transport\NamingConventions\AzureQueueNamingConvention.cs:line 13
   at NServiceBus.Transports.ConfigureTransport.<.ctor>b__1(SettingsHolder s) in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Transports\ConfigureTransport.cs:line 21
   at NServiceBus.Features.FeatureActivator.SetupFeatures(FeatureConfigurationContext context) in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Features\FeatureActivator.cs:line 109
   at NServiceBus.Configure.Initialize() in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Configure.cs:line 115
   at NServiceBus.Bus.Create(BusConfiguration configuration) in c:\BuildAgent\work\1b05a2fea6e4cd32\src\NServiceBus.Core\Bus.cs:line 19
   at NServiceBus.GenericHost.PerformConfiguration(Action`1 moreConfiguration) in c:\BuildAgent\work\a3de8759ee491634\src\NServiceBus.Hosting.Windows\GenericHost.cs:line 119
   at NServiceBus.GenericHost.Start() in c:\BuildAgent\work\a3de8759ee491634\src\NServiceBus.Hosting.Windows\GenericHost.cs:line 58

这是端点配置:

public class EndpointConfig : IConfigureThisEndpoint
{
    public void Customize(BusConfiguration configuration)
    {
        configuration.UseTransport<AzureStorageQueueTransport>();
        configuration.UsePersistence<InMemoryPersistence>();
        configuration.EndpointName("employee.messagehandler");
    }
}

app.config:

 <?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" />
    <section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" />
    <section name="AuditConfig" type="NServiceBus.Config.AuditConfig, NServiceBus.Core" />
    <section name="Logging" type="NServiceBus.Config.Logging, NServiceBus.Core" />
      <section name="AzureQueueConfig" type="NServiceBus.Config.AzureQueueConfig, NServiceBus.Azure.Transports.WindowsAzureStorageQueues" />
  </configSections>
    <Logging Threshold="Debug" />
  <connectionStrings>
      <add name="NServiceBus/Transport" connectionString="DefaultEndpointsProtocol=https;AccountName=..;AccountKey=.." />
  </connectionStrings>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
  </startup>
  <MessageForwardingInCaseOfFaultConfig ErrorQueue="error" />
  <UnicastBusConfig>
    <MessageEndpointMappings />
  </UnicastBusConfig>
   <AuditConfig QueueName="audit" />
  <AzureQueueConfig ConnectionString="DefaultEndpointsProtocol=https;AccountName=..;AccountKey=.." />
</configuration>

我使用的是NServiceBus.Host.exe而不是azure hosting。

1 个答案:

答案 0 :(得分:0)

将NServiceBus nuget软件包升级到使用5.2.0或更高版本。