Exception 开始调试时,我的程序类上出现NServiceBus未处理异常
非生产问题: 在从NServiceBus 3迁移到4以及从VS2010迁移到2012之后,当我开始调试时,我的程序类上出现了这个未经处理的异常。此异常源于NServiceBus.Host库Exception 开始调试时,我的程序类上出现NServiceBus未处理异常,exception,nservicebus,unhandled,Exception,Nservicebus,Unhandled,非生产问题: 在从NServiceBus 3迁移到4以及从VS2010迁移到2012之后,当我开始调试时,我的程序类上出现了这个未经处理的异常。此异常源于NServiceBus.Host库 System.Configuration.ConfigurationErrorsException was unhandled HResult=-2146232062 Message=Unable to set the value for key: ScaleOut.UseSingleBrokerQu
System.Configuration.ConfigurationErrorsException was unhandled
HResult=-2146232062
Message=Unable to set the value for key: ScaleOut.UseSingleBrokerQueue. The settings has been locked for modifications. Please move any configuration code earlier in the configuration pipeline
Source=NServiceBus.Core
BareMessage=Unable to set the value for key: ScaleOut.UseSingleBrokerQueue. The settings has been locked for modifications. Please move any configuration code earlier in the configuration pipeline
Line=0
StackTrace:
at NServiceBus.Settings.SettingsHolder.EnsureWriteEnabled(String key) in y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Core\Settings\SettingsHolder.cs:line 174
at NServiceBus.Settings.SettingsHolder.Set(String key, Object value) in y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Core\Settings\SettingsHolder.cs:line 57
at NServiceBus.Settings.ScaleOutSettings.UseSingleBrokerQueue() in y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Core\Settings\ScaleOutSettings.cs:line 18
at NServiceBus.Hosting.Windows.Roles.Handlers.ServerRoleHandler.<ConfigureRole>b__0(ScaleOutSettings s) in y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Hosting.Windows\Roles\Handlers\ServerRoleHandler.cs:line 17
at NServiceBus.Configure.ScaleOut(Action`1 customScaleOutSettings) in y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Core\Configure.cs:line 185
at NServiceBus.Hosting.Windows.Roles.Handlers.ServerRoleHandler.ConfigureRole(IConfigureThisEndpoint specifier) in y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Hosting.Windows\Roles\Handlers\ServerRoleHandler.cs:line 19
at NServiceBus.Hosting.Roles.RoleManager.ConfigureBusForEndpoint(IConfigureThisEndpoint specifier) in y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Core\Hosting\Roles\RoleManager.cs:line 67
at NServiceBus.Hosting.GenericHost.PerformConfiguration() in y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Core\Hosting\GenericHost.cs:line 189
at NServiceBus.Hosting.GenericHost.Start() in y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Core\Hosting\GenericHost.cs:line 86
at NServiceBus.Hosting.Windows.WindowsHost.Start() in y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Hosting.Windows\WindowsHost.cs:line 55
at NServiceBus.Hosting.Windows.Program.<>c__DisplayClasse.<Main>b__6(WindowsHost service) in y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Hosting.Windows\Program.cs:line 80
at Topshelf.Internal.ControllerDelegates`1.StartActionObject(Object obj) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\ControllerDelegates.cs:line 18
at Topshelf.Internal.IsolatedServiceControllerWrapper`1.<>c__DisplayClass2.<set_StartAction>b__1(TService service) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\IsolatedServiceControllerWrapper.cs:line 65
at Topshelf.Internal.ServiceController`1.<.cctor>b__1(ServiceController`1 sc) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\ServiceController.cs:line 35
at Magnum.StateMachine.LambdaAction`1.Execute(T instance, Event event, Object parameter) in :line 0
at Magnum.StateMachine.EventActionList`1.Execute(T stateMachine, Event event, Object parameter) in :line 0 at NServiceBus.Hosting.Windows.Program.Main(String[] args) in y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Hosting.Windows\Program.cs:line 151
InnerException:
System.Configuration.ConfigurationErrorsException未处理
HResult=-2146232062
Message=无法设置键的值:ScaleOut.UseSingleBrokerQueue。设置已被锁定以进行修改。请将任何配置代码移到配置管道的前面
Source=NServiceBus.Core
BareMessage=无法设置键的值:ScaleOut.UseSingleBrokerQueue。设置已被锁定以进行修改。请将任何配置代码移到配置管道的前面
直线=0
堆栈跟踪:
在y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Core\Settings\SettingsHolder.cs中的NServiceBus.Settings.SettingsHolder.EnsureEnabled(字符串键):第174行
在y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Core\Settings\SettingsHolder.Set(字符串键,对象值)中的NServiceBus.Settings.SettingsHolder.Set(字符串键,对象值):第57行
在y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Core\Settings\ScaleOutSettings.cs中的NServiceBus.Settings.ScaleOutSettings.UseSingleBrokerQueue()处:第18行
在y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Hosting.Windows.Roles.Handlers.ServerRoleHandler.b_0(缩放设置)中的NServiceBus.Hosting.Windows\Roles\Handlers\ServerRoleHandler.cs:第17行
在y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Core\Configure.cs中的NServiceBus.Configure.ScaleOut(操作'1 customScaleOutSettings):185行
位于y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Hosting.Windows.Roles.Handlers.ServerRoleHandler.ConfigureRole(IConfigureThiseEndpoint说明符)中的NServiceBus.Hosting.Windows\Roles\Handlers\ServerRoleHandler.cs:第19行
在y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Core\Hosting\Roles\RoleManager.ConfigureBusForEndpoint(IConfigureThiseEndPoint说明符)中的NServiceBus.Hosting.RoleManager.ConfigureBusForEndpoint(IConfigureThiseEndPoint说明符):第67行
在y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Core\Hosting\GenericHost.cs中的NServiceBus.Hosting.GenericHost.PerformConfiguration()处:第189行
在y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Core\Hosting\GenericHost.cs中的NServiceBus.Hosting.GenericHost.Start()处:第86行
在y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Hosting.Windows\WindowsHost.Start()中的NServiceBus.Hosting.Windows.WindowsHost.Start()处:第55行
在y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Hosting.Windows.Program.c__显示classe.b___6(WindowsHost服务):第80行
在c:\Projects\topshelfornsb\src\Topshelf\Internal\ControllerDelegates`1.StartActionObject(Object obj)中的Topshelf.Internal.ControllerDelegates中:第18行
在c:\Projects\topshelfornsb\src\Topshelf\Internal\isolatedservicecontrollerrapper`1.c_u显示Class2.b_u1(服务服务)在c:\Projects\topshelfornsb\src\Topshelf\Internal\isolatedservicecontrollerrapper.cs:第65行
在c:\Projects\topshelfornsb\src\Topshelf\Internal\ServiceController`1.b_uuu1(ServiceController`1 sc)中的Topshelf.Internal.ServiceController`1(ServiceController`1 sc):第35行
在Magnum.StateMachine.LambdaAction`1.Execute(T实例、事件、对象参数)中:第0行
在y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Hosting.Windows.Program.Main(字符串[]args)的第0行中的Magnum.StateMachine.EventActionList`1.执行(T StateMachine,事件,对象参数):第151行
内部异常:
Stacktrace:NServiceBus.Host.exe!NServiceBus.Hosting.Windows.Program.Main(字符串[]args)第149c行#
app.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="TransportConfig" type="NServiceBus.Config.MsmqTransportConfig, NServiceBus.Core" />
<section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" />
<section name="SecondLevelRetriesConfig" type="NServiceBus.Config.SecondLevelRetriesConfig, NServiceBus.Core" />
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="GripHandlers.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
<section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" />
<section name="AuditConfig" type="NServiceBus.Config.AuditConfig, NServiceBus.Core" />
</configSections>
<appSettings>
<add key="DB" value="Data Source=Miguel;persist security info=True;user id=Miguel;password=Miguel" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
<add key="LogDir" value="c:\Grip\OutputMessages" />
</appSettings>
<SecondLevelRetriesConfig Enabled="false" TimeIncrease="00:00:10" NumberOfRetries="3" />
<TransportConfig NumberOfWorkerThreads="4" MaxRetries="5" />
<UnicastBusConfig TimeoutManagerAddress="" DistributorControlAddress="" DistributorDataAddress="">
<MessageEndpointMappings>
<add Messages="Grip.Gateway.Events.Grip.ProcessedWithQualityIssuesEvent, Grip.Gateway.Events.Grip" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.External.ExternalPlacementDeletedEvent, Grip.Gateway.Events.External" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.External.ExternalPlacementModifiedEvent, Grip.Gateway.Events.External" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.External.ExternalTradeAddedEvent, Grip.Gateway.Events.External" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.External.ExternalTradeDeletedEvent, Grip.Gateway.Events.External" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.External.ExternalTradeModifiedEvent, Grip.Gateway.Events.External" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.Grip.GripGatewayNotifiedEvent, Grip.Gateway.Events.Grip" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.Grip.IntegrationExceptionEvent, Grip.Gateway.Events.Grip" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.Grip.AddAGripPlacementProcessedByService, Grip.Gateway.Events.Grip" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.Grip.PlacementAddedToGripEvent, Grip.Gateway.Events.Grip" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.Grip.PlacementModifiedInGripEvent, Grip.Gateway.Events.Grip" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.Grip.PlacementDeletedInGripEvent, Grip.Gateway.Events.Grip" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.Grip.TradeAddedToGripEvent, Grip.Gateway.Events.Grip" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.Grip.TradeModifiedInGripEvent, Grip.Gateway.Events.Grip" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.Grip.TradeDeletedInGripEvent, Grip.Gateway.Events.Grip" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.Grip.PlacementLinkedInGripEvent, Grip.Gateway.Events.Grip" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.Grip.PlacementUnLinkedInGripEvent, Grip.Gateway.Events.Grip" Endpoint="Worker" />
</MessageEndpointMappings>
</UnicastBusConfig>
<applicationSettings>
<GripHandlers.Properties.Settings>
<setting name="MonitorPerformance" serializeAs="String">
<value>False</value>
</setting>
<setting name="EndpointSLA" serializeAs="String">
<value>10</value>
</setting>
</GripHandlers.Properties.Settings>
</applicationSettings>
<MessageForwardingInCaseOfFaultConfig ErrorQueue="ERROR" />
<log4net debug="false">
<appender name="file" type="log4net.Appender.RollingFileAppender">
<file>c:\Grip\Logs\GripHandlers.log</file>
<maximumFileSize value="5MB" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] <%X{auth}> - %m%n" />
</layout>
</appender>
<appender name="console" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] <%X{auth}> - %m%n" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="file" />
<appender-ref ref="console" />
</root>
</log4net>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="StructureMap" publicKeyToken="e60ad81abae3c223" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.4.0" newVersion="2.6.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NServiceBus.Core" publicKeyToken="9fc386479f8a226c" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.6.0.0" newVersion="4.6.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NServiceBus" publicKeyToken="9fc386479f8a226c" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.6.0.0" newVersion="4.6.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<AuditConfig QueueName="audit" />
</configuration>
要包括的有用信息
产品名称:NServiceBus
版本:4.6.1来自您发布的链接:您是否尝试删除CreateBus()和Start()?我认为当您使用ASA_服务器时,不再需要这些菲尔·桑德勒2天前
感谢Phil。发布配置和代码的内容,而不是需要权限的google文档链接。同时发布错误消息和至少部分堆栈跟踪。它可能是app.config中的行吗?发布配置的内容和代码:Done!从您发布的链接中:您是否尝试删除CreateBus()和Start()?我认为当您使用ASA_服务器时,不再需要这些了。谢谢。我会避免用别人评论中收到的答案来回答我自己的问题……至少我会先让他把它作为答案贴出来,标记为接受,如果他拒绝,我会这样做。当然这只是我个人的观点。。。
using System;
using System.Diagnostics.CodeAnalysis;
using System.Transactions;
using GripHandlers.Properties;
using NServiceBus;
using StructureMap;
namespace GripHandlers
{
[ExcludeFromCodeCoverage]
public class EndpointConfig : IConfigureThisEndpoint, IWantCustomInitialization, AsA_Server
{
public void Init()
{
SetLoggingLibrary.Log4Net(() => log4net.Config.XmlConfigurator.Configure());
var container = new Container(new GripHandlersRegistry());
Configure.Transactions
.Advanced(settings => settings.IsolationLevel(IsolationLevel.RepeatableRead))
.Enable();
//Tried this but no luck :(
//Configure.ScaleOut(s => s.UseUniqueBrokerQueuePerMachine());
Configure.With(AllAssemblies.Except("Oracle.DataAccess.dll"))
.StructureMapBuilder(container)
.UnicastBus()
.UseTransport<Msmq>()
.SetEndpointSLA(new TimeSpan(0, 0, Settings.Default.EndpointSLA))
.EnablePerformanceCounters()
.CreateBus()
.Start(() => Configure.Instance.ForInstallationOn<NServiceBus.Installation.Environments.Windows>().Install());
}
}
}