Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure: Could not load file or assembly 'Microsoft.ServiceBus

I have a app fabric service that I want to test. (http://xxx.cloudapp.net:8081/service.svc).
I created a console app and added a service reference to the service and got the following error:

Could not load file or assembly 'Microsoft.ServiceBus, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

I added a reference to Microsoft.ServiceBus from C:\Program Files (x86)\Windows Azure platform AppFabric SDK\V1.0\Assemblies\NET4.0

I set all assemblies in my project to Copy Local = True, as suggested here: http://msdn.microsoft.com/en-us/library/ee706702.aspx

Additional Due diligence: I opened Microsoft.ServiceBus in red-gate's reflector and confirmed that it is the correct version. Just for kicks, I also added references to each assembly referenced in reflector and set all references to copy local = true.

Any other ideas?

…Peter

like image 883
Peter Walke Avatar asked Oct 04 '10 21:10

Peter Walke


3 Answers

Make sure you change the Target Framework (Project properties/Application tab) from '.NET Framework 4 Client Profile' to '.NET Framework 4'. I found a similar post and that was what helped me. I believe it has to with the fact that Microsoft.ServiceBus is not supported by the client profile of .NET 4.

like image 142
Sijmen Koffeman Avatar answered Nov 14 '22 18:11

Sijmen Koffeman


When you reference Microsoft.ServiceBus.dll, reference it from the install location, e.g.,

C:\Program Files (x86)\Windows Azure platform AppFabric
SDK\V1.0\Assemblies\NET4.0\Microsoft.ServiceBus.dll

... not from the GAC, and set Copy Local to true.

You need to do this in whatever you are deploying into Azure; the Microsoft.ServiceBus.dll needs to packaged with your project because it is not available by default in Azure.

If you fire up Fiddler, you see a 500 error when calling the service. This proves that the exception isn't in your calling application.

like image 43
George Durzi Avatar answered Nov 14 '22 18:11

George Durzi


ServiceBus dll is not installed on Azure boxes

  1. Make sure your reference to the assembly specifies COPY LOCAL
  2. Also make sure you don’t have references to the service bus dll in upper projects which do NOT copy local (this might be your problem if you have verified 1 above)

You can check the CSX tree for your azure build folder to see if the assembly is being copied into the final package. That’s a lot quicker than uploading to azure or starting the dev fabric.

That should solve your problem

like image 32
Rajesh Batheja Avatar answered Nov 14 '22 18:11

Rajesh Batheja