WPF Best pratice for MassTransit Init

Skip to first unread message

Terry Massey

unread,
Dec 30, 2011, 1:02:48 PM12/30/11
to masstrans...@googlegroups.com

All,

So I am working on a large enterprise wide Project and I am prototyping out for test of MassTransit with RabbitMQ and WPF. I have recreated essentially a slimmed down test case of your StarBucks app but for the customer I am using WPF. The problem is I am not sure the best place to Initialize MassTransit in the WPF Client. So that is question 1.

 

Question two is I think the nugget packages are broken. Well at least the ones I installed into my project. I get a topshelf exception because the log4net version that auto installed as a dependency is version 4 and it is looking for version 1.2.10.0

 

thanks,

Terry 

System.TypeInitializationException was unhandled

  Message=The type initializer for 'Topshelf.HostFactory' threw an exception.

  Source=Topshelf

  TypeName=Topshelf.HostFactory

  StackTrace:

       at Topshelf.HostFactory.Run(Action`1 configure)

       at ServerComponent.Server.Main() in C:\Users\terry\documents\visual studio 2010\Projects\Sc2.MassTransit.RabbitMqTest\ServerComponent\Server.cs:line 45

       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)

       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)

       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

       at System.Threading.ThreadHelper.ThreadStart()

  InnerException: System.IO.FileLoadException

       Message=Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

       Source=Topshelf

       FileName=log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821

       FusionLog==== Pre-bind state information ===

LOG: DisplayName = log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821

(Fully-specified)

LOG: Appbase = file:///C:/Users/terry/documents/visual studio 2010/Projects/Sc2.MassTransit.RabbitMqTest/ServerComponent/bin/Debug/

LOG: Initial PrivatePath = NULL

Calling assembly : Topshelf, Version=2.2.2.0, Culture=neutral, PublicKeyToken=null.

===

LOG: This bind starts in default load context.

LOG: No application configuration file found.

LOG: Using host configuration file:

LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.

LOG: Post-policy reference: log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821

LOG: Attempting download of new URL file:///C:/Users/terry/documents/visual studio 2010/Projects/Sc2.MassTransit.RabbitMqTest/ServerComponent/bin/Debug/log4net.DLL.

WRN: Comparing the assembly name resulted in the mismatch: Build Number

ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

 

       StackTrace:

            at Topshelf.HostFactory..cctor()

       InnerException:

 

Dru Sellers

unread,
Dec 30, 2011, 1:28:39 PM12/30/11
to masstrans...@googlegroups.com
you want to initialize the bus at the start of the application, typically when you spin up the container. are you using IoC?

i believe there is a fix coming that will lock down the log4net issue. so hopefully that will squash that.

-d

 

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To post to this group, send email to masstrans...@googlegroups.com.
To unsubscribe from this group, send email to masstransit-dis...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/masstransit-discuss?hl=en.

Terry Massey

unread,
Dec 30, 2011, 1:35:55 PM12/30/11
to masstrans...@googlegroups.com
Dru,
Yes I am using Windsor, 

that is awesome. 

Thanks,
Terry Massey

Dru Sellers

unread,
Dec 30, 2011, 1:38:28 PM12/30/11
to masstrans...@googlegroups.com
so with windsor I like to have an 'installer' that contains all of the MT setup, and then just add it to the initialization process of the IoC.

-d

Dru Sellers

unread,
Dec 30, 2011, 1:39:13 PM12/30/11
to masstrans...@googlegroups.com

Peter Hageus

unread,
Dec 31, 2011, 5:48:18 AM12/31/11
to masstrans...@googlegroups.com
Regarding log4net: You can set allowedVersions in your package.config to force log4net 1.2.10. 

/Peter

David Christiansen

unread,
Jan 19, 2012, 5:30:04 AM1/19/12
to masstransit-discuss
If you are still having bother with the log4net public key change
issue (the version obtained from nuget has the new public key) then
you may wish to look at this post on stackoverflow for a work around

http://stackoverflow.com/questions/8743992/how-do-i-work-around-log4net-keeping-changing-publickeytoken/8806628#8806628

Kind Regards,
DC
Reply all
Reply to author
Forward
0 new messages