ian ian
ian ian

Reputation: 153

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>

Upvotes: 15

Views: 6496

Answers (2)

Erik Bergman
Erik Bergman

Reputation: 1

It did not solve my problem, but as it turned out, changing version to 3.0.0.1 did:

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

And:

<runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.1" /> </dependentAssembly> </assemblyBinding> </runtime> <applicationSettings>

Upvotes: 0

Harminder
Harminder

Reputation: 2229

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.

Upvotes: 40

Related Questions