How to resolve the “Could not load file or assembly” Issues on Windows AZure Web Sites


One of the most common problems reported regarding Windows Azure Web Sites is “Assembly Loading” issue. Here are some of the forum posts.


If you site works well locally. However, after you deployed to WAWS, it doesn’t work anymore, then you need to consider about this. It is really easy to isolate the problem, just merge follows into your web.config,



         <customErrors mode="Off"/>



And you should see the error in your browser.


Could not load file or assembly xxxxxx, Version=x.x.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxx or one of its dependencies. The system cannot find the file specified.


The hosting environment of WAWS contains a standard installation of .Net framework 2.0 to .Net framework 4.5. If your application referenced assemblies which is not build in .Net framework, you have to “include” them with your deploy package. Even these are Microsoft assemblies.


Here is the steps to deploy the referenced assemblies with your application.


1.       I have a project need to access Windows Azure Storage Table, to implement this feature, I referenced Microsoft.WindowsAzure.StorageClient.dll.

2.       In Visual Studio, Find the referenced assembly in “Solution Explorer”, In the “Properties” window, set the “Copy Local” to “True”.



Another common reason is WAWS runs 32bit IIS worker process running on X64 system. So, if the assembly you referenced is not platform neutral, and unfortunately, you referenced the X64 bit version. You will hit the problem as well. In case of this, you should see follow message after merging follows into your web.config,



         <customErrors mode="Off"/>



Exception message: Could not load file or assembly ‘xxxxxx or one of its dependencies. An attempt was made to load a program with an incorrect format


See you next time.


Wei Zhao from APGC DSI Team

Comments (1)

  1. Chris Schaller says:

    Thanks for the post, note that Azure Websites now allows you to change your runtime to 64bit process, if you have done this then you may get the same error if you try to run x86 dlls, in which case the solution is to use the x64 or neutral version of your referenced assemblies… if you can find them 🙂

Skip to main content