NServiceBus Publish/Subscribe Example -- Couldnt load assembly NServiceBus.Core or its dependency

2

I am new to NServiceBus. I have download the latest build from NSERvice bus website. When i run the PUBLISH Subscribe sample, i get the following error. I have no idea whats going wrong. All assemblies are there. May be it is with in the framework.

Can anyone shed some light in it?

NServiceBus.Host.Internal.GenericHost <(null)> - System.IO.FileLoadException: Could not load file or assembly file:/enter code here //C:\NServiceBus.net 4.0\samples\PubSub\Subscriber1\bin\Debug\NServiceBus.Core. dll or one of its dependencies. Operation is not supported. (Exception from HRE SULT: 0x80131515)

visual-studio-2010
.net-4.0
nservicebus
asked on Stack Overflow Nov 11, 2011 by Tanvir Huda • edited Jan 6, 2012 by Mattl

2 Answers

5

In .NET 4, there are restrictions on running "unfamiliar" assemblies. You will probably need to add a NServiceBus.Host.exe.config with the following which will allow the assemblies to run:

<configuration>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
  <runtime>
    <loadFromRemoteSources enabled="true"/>
  </runtime>
</configuration>
answered on Stack Overflow Nov 11, 2011 by Adam Fyles • edited Sep 6, 2012 by Espo
0

If you're using Windows 7 then You need to unblock the assemblies as they have been flagged as being untrustworthy. The easiest way (without adding config files) is to right click on the zipped NServiceBus download, select properties and hit the "Unblock" button:

enter image description here

Now when you uncompress the archive it should build and run in Visual Studio 2010 without the error message you are receiving.

This is all explained in the NServiceBus Getting Started Guide and also see what Microsoft have to say about Assemblies they consider untrustworthy here.

answered on Stack Overflow Jan 6, 2012 by Mattl • edited Jan 29, 2016 by Peter

User contributions licensed under CC BY-SA 3.0