We have an ASP.NET MVC4 website which uses NServiceBus to send messages to different services. Since these services are not installed in our Dev environment, therefore we hold service bus installation for local development. We use the Autofack module registered in our application_start to configure just the example for injection in our controller to set this up.
My NSB 3.3 Configuration:
Public Class Service Module: Module {Protected Override Zero Load (ContainerBuilder Builder) {builder.Register & LT; Ibus & gt; ((C, p) = & gt; {var useServiceBus = bool.Parse (ConfigurationManager.AppSettings [ "useServiceBus"]); if (useServiceBus) {return NServiceBus.Configure.With () .Log4Net () .DefaultBuilder (). XmlSerializer () .MsmqTransport (). IsTransactional (wrong) .PurgeOnStartup (wrong) .MsmqSubscriptionStorage () .UnicastBus (). ImpersonateSender (wrong) .CreateBus () .Start (() = & gt; NServiceBus.Configure.Instance.ForInstallationOn & LT; NServiceBus.Installation.Environments.Windows & gt ;. () install ());} else c.Resolve or & lt return; Tes tServiceBus & gt; ();}). an event (); }}
My attempt NS B 5.0.3 configuration:
public class ServiceModule: module {protected override void Load (ContainerBuilder builder) {builder .Register & LT; Ibus & gt; ((C, p) = & gt; {var useServiceBus = bool.Parse (ConfigurationManager.AppSettings [ "useServiceBus"]); if (useServiceBus) {var config = new BusConfiguration (); configuration.UsePersistence & LT; RavenDBPersistence & gt ; (); configuration.RegisterComponents (r = & gt; {r.ConfigureComponent & LT; EnvironmentMessageMutator & gt; (() = & gt; new EnvironmentMessageMutator (new DetectsEnvironment () GetEnvironment ()), DependencyLifecycle.InstancePerCall) ;.} ); Return Bus.Create (configuration);} and return c.Resolve & lt; TestServiceBus> ();}). Single instance (); }}
Bus.Create is failing with an ObjectDisposedException, "No Excluded Object Can Access to an Excluded Object" on CommonObjectBuilder. I have a document on the right way to install it in NSB5 How to configure regular NSISbus injection to allow stabilization described above, or not to us as described above.
(It should be tagged NSSCS5, but I do not have a reputation)
The solution is to establish.
Comments
Post a Comment