Could not load file or assembly 'Microsoft.Practices.Unity - asp.net-mvc-3

I tried install unity.mvc4 using NuGet while installing it gave an error because it required .net4.5 framework so I uninstalled it and remove the package file and installed unity.MVC3.
Now I tried to run the application and it gives me the error below.
I checked the web.config and no entry in web.config. I don't know from where it is referring the version=3.0.0. Please help me to resolve the issue. I don't want unity 3.0 version I want unity 2.1.
Server Error in '/' Application.
Could not load file or assembly 'Microsoft.Practices.Unity,
Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or
one of its dependencies. The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not load
file or assembly 'Microsoft.Practices.Unity, Version=3.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its
dependencies. The system cannot find the file specified.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to
determine why the assembly 'Microsoft.Practices.Unity,
Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
could not be loaded.
=== Pre-bind state information === LOG: User = xxxxx LOG: DisplayName = Microsoft.Practices.Unity,
Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified) LOG: Appbase =
Stack Trace:
[FileNotFoundException: Could not load file or assembly
'Microsoft.Practices.Unity, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The
system cannot find the file specified.]
Unity.Mvc4.UnityDependencyResolver.DisposeOfChildContainer() +0
Unity.Mvc4.RequestLifetimeHttpModule.b__0(Object sender,
EventArgs e) +31
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+136 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69
Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.0.30319.17929

Within your web.config, add the following in the runtime section:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Practices.Unity" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Practices.ServiceLocation" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
</dependentAssembly>
</assemblyBinding>

Related

'Could not load file or assembly 'FSharp.Core, Version=4.6.2.0

I upgraded Visual Studio from VS2017 to VS2019. I opened a solution with both C# and F# in it. A C# unit test project references a F# .dll project.
The solution compiles fine but at run time, I get the following message
System.IO.FileLoadException: 'Could not load file or assembly
'FSharp.Core, Version=4.6.2.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)'
and the inner exception is
Could not load file or assembly 'FSharp.Core, Version=4.6.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
I have this in the unit tests app.config:
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.6.2.0" newVersion="4.6.2.0" />
</dependentAssembly>
and the unit test project has this in the packages.config
<package id="FSharp.Core" version="4.6.2" targetFramework="net461" />
Is there a missing reference I am not seeing?
Thanks
Bent Tranberg was right
In the test project, I changed the binding redirect to
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.6.2.0" newVersion="4.6.0.0" />
</dependentAssembly>
and it worked

Could not load file or assembly 'System.Web.Http.WebHost, Version=5.0.0.0

I'm getting this dreaded error trying to use Ninject with Web API. The full message is:
An exception of type 'System.IO.FileLoadException' occurred in
Ninject.dll but was not handled in user code
Additional information: Could not load file or assembly
'System.Web.Http.WebHost, Version=5.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
I've tried reinstalling pretty much everything, setting copy local = true, cleaning and rebuilding, restarting VS, deleting the suo, verifying binding redirects, etc etc etc. Nothing.
The one thing I don't fully understand is why everything is referencing v 5.2.3 when the error says it's trying to load 5.0.0. Could be a clue; I don't know. Here's the redirect from web.config. Thanks for any assistance.
<dependentAssembly>
<assemblyIdentity name="System.Web.Http.WebHost" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>

DotNetOpenAuth.Asp Couldnt Load Assembly or one of its dependencies in MVC4 App Unit Tests

I am facing with very strange error in my project. I installed DotnetOpenAuth.Aspnet and Microsoft.AspNet.WebPages.OAuth libraries nuget packages. When I run the project there is no problem. But When I write the test for controllers it is throwing an exception like the following.
Test method MvcApplication2.Tests.ControllerTest.should_return_not_empty_content threw exception:
System.IO.FileLoadException: Could not load file or assembly 'DotNetOpenAuth.AspNet, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246'
or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Another strange point is If I setup a project in VS 2010 as MVC3 application and tests are passing. No failure. But When I do the exactly same setup in VS2012 it is firing the same error as above.
When I search on stackoverflow I saw this solution but it didnt work either.
You can find all projects and sample tests in the following lines. It is just one app one test project. Very easy to read.
Also I added a sample code in here for controller and failing test.
The pastebin link for code preview is http://pastebin.com/1PCpq3hW
Any help would be appreciated.
Vs2010 and 2012 failing and succeeding projects
A detailed log result like the following
*** Assembly Binder Log Entry (13.12.2012 # 22:27:31) ***
The operation failed.
Bind result: hr = 0x80131040. No description available.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Program Files (x86)\JetBrains\ReSharper\v7.0\Bin\JetBrains.ReSharper.TaskRunner.CLR4.exe
--- A detailed error log follows.
=== bind state information ===
LOG: User = DEVELOPER-PC\DEVELOPER
LOG: DisplayName = DotNetOpenAuth.AspNet, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246
(Fully-specified)
LOG: Appbase = file:///D:/Development/Coachius/CoachiusWeb.Tests/bin/Debug
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : CoachiusWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\Development\Coachius\CoachiusWeb.Tests\bin\Debug\CoachiusWeb.Tests.dll.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: DotNetOpenAuth.AspNet, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///D:/Development/Coachius/CoachiusWeb.Tests/bin/Debug/DotNetOpenAuth.AspNet.DLL.
LOG: Assembly download was successful. Attempting setup of file: D:\Development\Coachius\CoachiusWeb.Tests\bin\Debug\DotNetOpenAuth.AspNet.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: DotNetOpenAuth.AspNet, Version=4.1.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246
WRN: Comparing the assembly name resulted in the mismatch: Minor Version
ERR: The assembly reference did not match the assembly definition found.
ERR: Run-from-source setup phase failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
I have solved it with
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
I think I may have found a possible solution.
See this link
The key pieces of information here are at lines 3 and 7. Basically, Microsoft.Web.WebPages.OAuth needs DotNetOpenAuth.Core 4.0.0.0, but the DotNetOpenAuth.Core I have is version 4.3.0.0.
This is due to a very nasty bug in VS 2012. In VS 2012 in the test projects, assembly redirection in app.config file doesn't work.
This explains why it works in VS 2010 and not in VS 2012.
It is quite annoying.
A work around is to add a .testsettings file and associate it from the test menu to the project. You have to go to a solution folder for that, if not you will not see it in the menu.
Beware, a lot of resource on the internet says runsettings with forcing older version to work will do the trick, it will not. It will crash your VS / test process. You need a testsettings file.
What you are doing by that is to use VS2010 runner, which doesn't have this bug. On the other hand it is slower.
I hope Microsoft fixes this soon, the problem is not only with OpenAuth but literally with every DLL using a different version from another DLL.
Welcome to DLL Hell version year 2012.
Look for bindingRedirects in your web.config file and make sure they also exist in your unit test's app.config file.
Did you add the assemblies to your test project?
They should show up in the folder when you compile. Since your test project is the host, it needs the same assemblies for test (depending on the setup but as a general rule)
If so, then you can look a step further in the actual binding details.
See my posting here on enabling fusion logging.
How to enable assembly bind failure logging (Fusion) in .NET
Enable it, check the folder and look for bind failures - you'll see what assembly is trying to load it (usually). If you don't - enable successes and failures and in turn look at all the assembly versions. Sometimes you'll see multiple versions loaded which helps track down the issue, or an unexpected version.
I changed the versions to 4.1.0.0 and it worked for me
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780CCD10D57B246" culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780CCD10D57B246" culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>

Migrating my MVC 3 application to MVC 4

I really do not know what to do, I'm following this article that shows how to migrate my MVC 3 application manually .
I followed all the steps but when running my application the following error occurs:
Server Error in '/' Application.
Could not load file or assembly 'System.Web.WebPages.Razor,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or
one of its dependencies. The located assembly's manifest definition
does not match the assembly reference. (Exception from HRESULT:
0x80131040)
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.IO.FileLoadException: Could not load file or
assembly 'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to
determine why the assembly 'System.Web.WebPages.Razor,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
could not be loaded.
WRN: Assembly binding logging is turned OFF. To enable assembly bind
failure logging, set the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There
is some performance penalty associated with assembly bind failure
logging. To turn this feature off, remove the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog].
Stack Trace:
[FileLoadException: Could not load file or assembly
'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)]
Microsoft.Web.Samples.PreApplicationStartCode.Start() +0
[InvalidOperationException: The pre-application start initialization
method Start on type Microsoft.Web.Samples.PreApplicationStartCode
threw an exception with the following error message: Could not load
file or assembly 'System.Web.WebPages.Razor, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040).]
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1
methods) +423
System.Web.Compilation.BuildManager.CallPreStartInitMethods() +306
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager
appManager, IApplicationHost appHost, IConfigMapPathFactory
configMapPathFactory, HostingEnvironmentParameters hostingParameters,
PolicyLevel policyLevel, Exception appDomainCreationException) +677
[HttpException (0x80004005): The pre-application start initialization
method Start on type Microsoft.Web.Samples.PreApplicationStartCode
threw an exception with the following error message: Could not load
file or assembly 'System.Web.WebPages.Razor, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040).]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9079340
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
wr, HttpContext context) +256
Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.0.30319.237
I looked through the code, but I see no reference to System.Web.WebPages.Razor in version 1.0 version 2.0 only.
Use NuGet and add the package Microsoft.AspNet.Mvc (Microsoft Asp.Net Mvc 4). This should upgrade your references. See:
https://nuget.org/packages/Microsoft.AspNet.Mvc
You will need to upgrade the assembly references in your web.config.
Remove from the root web.config:
<assemblies>
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
Add to the root web.config:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Views/Web.Config:
Change Razor from 1.0.0.0 to 2.0.0.0:
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages validateRequest="false"
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<controls>
<add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
</controls>
</pages>
Did you forget to update the references in Views\Web.Config? The references in it is used to build the view pages.
I assumed you have MVC3 Intranet web application, when upgrade from MVC3 to MVC4 using NuGet, your application now references System.Web.WebPages.Razor Version 2.0.0.0, NOT System.Web.WebPages.Razor Version 1.0.0.0 anymore. Here is my way of resolving the reference.
There are two places to fix:
In the root web.config,
<compilation debug="true" targetFramework="4.0">
<assemblies>
. . .
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
. . .
</assemblies>
</compilation>
change Version=1.0.0.0 to Version=2.0.0.0
So your new reference will look like this:
<compilation debug="true" targetFramework="4.0">
<assemblies>
. . .
<add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
. . .
</assemblies>
</compilation>
In the Views folder, there is web.config file. Inspecting this file you will see it references Version 1. Replace the whole web.config file in Views folder with a new web.config file. Make a backup of the old web.config file, just in case. To get a brand new web.config for the Views folder, you create a new MVC4 application for intranet. Go to the Views folder. Copy the Web.Config file from the Views folder of the new application to the Views folder of the broken application.
Hope it helps!
Reinstalling the AspNetSprite packages as suggested above does not solve the problem for me. But adding theses lines on the runtime\assemblyBinding section of the root web.config file works :
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
Have you globally searched for System.Web.WebPages.Razor, Version=1.0.0.0 in your entire solution? Do you still reference System.Web.WebPages.Razor (Version 1.0.0.0)? Do you reference System.Web.WebPages.Razor Version 2.0.0.0?
[Update] I finally ran into the same issue. It seems like one of the NuGet packages I installed and uninstalled didn't entirely remove the reference to System.Web.Razor it used. Cleaning the solution didn't help because the DLL wasn't used directly by the web application. I finally got it to work by manually deleting the entire bin directory ...
Check the web.config inside your views folder.
UPDATE:
This bit looks suspcious.
Microsoft.Web.Samples.PreApplicationStartCode
Are you referencing any sample application libraries, like MVC futures or anything like that?
My application used a third-party package, the AspNetSprites-MvcAndRazorHelper. Reinstalled this package and the error of the reference was corrected.
This is another Nuget package that u can use to upgrade mvc 3 to mvc 4
https://nuget.org/packages/UpgradeMvc3ToMvc4
this is very simple, when you update to MVC 4.0.0.0 ,but the webconfig in the solution still points to MVC 3.0.0.0.0.
so just replace MVC version 3.0.0.0.0. by 4.0.0.0.0
Do the same with other assemblies, to check the version of assembly , check properties of the respective assembly in references in your project.

Could not load file or assembly 'System.Web.Ajax, Version=3.0.31106.0

HI folks,
I have a .net application (vb.net) and I'm using the ajax control toolkit. It works fine on my production machine but when I upload it to the host (fasthosts) i get this error:
Could not load file or assembly 'System.Web.Ajax, Version=3.0.31106.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e' or one of its dependencies. The module was expected to contain an assembly manifest.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.BadImageFormatException: Could not load file or assembly 'System.Web.Ajax, Version=3.0.31106.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e' or one of its dependencies. The module was expected to contain an assembly manifest.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Ajax, Version=3.0.31106.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Stack Trace:
[BadImageFormatException: Could not load file or assembly 'System.Web.Ajax, Version=3.0.31106.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e' or one of its dependencies. The module was expected to contain an assembly manifest.]
AjaxControlToolkit.ToolkitScriptManager.ApplyAssembly(ScriptReference script, Boolean isComposite) +0
AjaxControlToolkit.ToolkitScriptManager.OnResolveScriptReference(ScriptReferenceEventArgs e) +167
System.Web.UI.ScriptManager.RegisterScripts() +191
System.Web.UI.ScriptManager.OnPagePreRenderComplete(Object sender, EventArgs e) +113
System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +8698462
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1029
Here is my web.conf file. Its very simple:
<system.web>
<customErrors mode="Off"/>
<compilation debug="true">
<assemblies>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation></system.web>
Does anyone know whats up?
-- Billy
In order to use ASP.NET AJAX, you would have installed the ASP.NET AJAX framework on your machine, which includes this DLL that is causing the error.
The chances are that your hosting company doesn't have ASP.NET AJAX installed.
This post is old but just in case someone else needs help in this issue. Below are 3 easy steps to fixing it:
Step 1: Download the latest ajax toolkit from Codeplex.com.
Step 2: Extract the zip file. (Optional) --> Google the net on how to add the new ajax controls to your Toolbox. It is also simple.
Step 3: Copy and paste all the contents of the extracted folder to the BIN folder of your project.
Rebuild and run it.

Resources