ASP.NET MVC 2 with NServiceBus unable to load requested types
Posted
by dp
on Stack Overflow
See other posts from Stack Overflow
or by dp
Published on 2010-04-05T20:26:52Z
Indexed on
2010/04/05
20:33 UTC
Read the original article
Hit count: 586
I am trying to use NServiceBus with an ASP.NET MVC 2 website (using VS 2010 and the .NET 4.0 framework). However, when I run the site on my local machine, I get the following error:
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Here are the relevant steps I have taken:
- Downloaded the NServiceBus.2.0.0.1145 binaries
- In my asp.net mvc app, I've added references to NServiceBus.dll and NServiceBus.Core.dll
- In Global.asax.cs I've added:
public static IBus Bus { get; private set; } protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes); Bus = NServiceBus.Configure .WithWeb() .Log4Net() .DefaultBuilder() .XmlSerializer() .MsmqTransport() .IsTransactional(false) .PurgeOnStartup(false) .UnicastBus() .ImpersonateSender(false) .CreateBus() .Start(); }
- In web.config, I've added:
<MsmqTransportConfig InputQueue="MyWebClient" ErrorQueue="error" NumberOfWorkerThreads="1" MaxRetries="5"/> <UnicastBusConfig> <MessageEndpointMappings> <add Messages="Messages" Endpoint="MyServerInputQueue"/> </MessageEndpointMappings> </UnicastBusConfig>
The error indicates that the problem is with the first line in the Global.asax.cs file. Is it possible that there is a problem with NServiceBus running under .NET 4.0?
© Stack Overflow or respective owner