title: in mvc3 razor i get error Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)
body: <p>I am working on mvc3 razor application firstly my project was runing correctly but after replacement of system.web.mvc.dll and System.Web.WebPages.Razor files from mvc4 folder to mvc3 folder it will give following error while run it.</p>
  
  <p>Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)</p>
  
  <p>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. </p>
  
  <p>Exception Details: System.IO.FileLoadException: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)</p>
  
  <p>Source Error: </p>
  
  <p>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.</p>
  
  <pre><code>Stack Trace: 
  
  
  [FileLoadException: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)]
  System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
  System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +192
  System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +108
  System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +324
  System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +132
  System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +90
  System.Web.Compilation.BuildManager.ExecutePreAppStart() +135
  System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516
  </code></pre>
  
  <p>[HttpException (0x80004005): Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)]
      System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9873912
      System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
      System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +456</p>
  
  <p>my web.config settings are as under</p>
  
  <pre><code>&lt;assemblies&gt;
      &lt;add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt;
      &lt;add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt;
      &lt;add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt;
      &lt;add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt;
      &lt;add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt;
      &lt;add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /&gt;
    &lt;/assemblies&gt;
  </code></pre>
  
  <p>Please provide me help to resolve it.</p>