Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GAC issue cant host application on IIS

I’m getting the following error when running my MVC 4 application on IIS 7.5. However, when I run this application via visual studio it does not throw the error. Also, I’ve tried hosting the application in my Uni computer it seems to work fine.

  Compiler Error Message: CS0433: The type 'System.Web.Mvc.WebViewPage<TModel>' exists in   both      'c:\windows\Microsoft.NET\assembly\GAC_MSIL\System.Web.Mvc\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Mvc.dll' and 'c:\windows\Microsoft.NET\assembly\GAC_MSIL\System.Web.Mvc\v4.0_3.0.0.0__31bf3856ad364e35\System.Web.Mvc.dll'

Here are the assemblies referenced in my web.config file

     <system.web>
         <compilation targetFramework="4.0">
            <assemblies>
                <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral,     PublicKeyToken=31BF3856AD364E35" />              
                <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />               
                <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
            </assemblies>
        </compilation>      
</system.web>
like image 703
ian ian Avatar asked Sep 17 '13 08:09

ian ian


Video Answer


1 Answers

Do you have System.Web.Mvc assembly in application bin folder? If so try removing

<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 

from web.config.

like image 138
Harminder Avatar answered Sep 28 '22 12:09

Harminder