I've just tried deploying an MVC3 application to our IIS7 hosting environment but I'm being presented wtih the following exception:
Could not load type
'Microsoft.Web.Infrastructure.DynamicModuleHelper.DynamicModuleUtility'
from assembly
'Microsoft.Web.Infrastructure,
Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'.
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.TypeLoadException: Could not
load type
'Microsoft.Web.Infrastructure.DynamicModuleHelper.DynamicModuleUtility'
from assembly
'Microsoft.Web.Infrastructure,
Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'.
Any suggestions?
The app isn't being bin deployed as I have installed ASP.Net Web pages and MVC3 on the web server itself.
This is because Microsoft.Web.Infrastructure
is not in your GAC. You need to add this reference to your project. Right click the reference and go to properties then set copy to local to true.
Output (Ignore the Ninject and NCU):
It turns out after doing a Reference Cleaning, it removed Microsoft.Web.Infrastructure
, but not from the packages.config file. After trying to add it again using the Package Manager Console
, Visual Studio says that it is already installed which is false because it was removed.
I then removed the line of code in the packages.config
file
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
and ran the command again
PM> Install-Package Microsoft.Web.Infrastructure
After this, now it works fine.
Microsoft.Web.Infrastructure
is now a Nuget package, and it can be added to your project to enable bin directory deployments --
http://nuget.org/packages/Microsoft.Web.Infrastructure
Make sure that the root web.config file on your server (located somewhere like here: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config
) has the following entry:
<configuration>
<location allowOverride="true">
<system.web>
<fullTrustAssemblies>
<add
assemblyName="Microsoft.Web.Infrastructure"
version="1.0.0.0"
publicKey="[bunch of letters and numbers]"
/>
If it's missing then it means that somebody messed with your .NET 4 installation.