0
votes

We have installed .NET 4.5.1 on some servers, and suddenly a legacy WCF Data Service application fails with the following error:

Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Mvc, Version=4.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 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.

=== Pre-bind state information === LOG: DisplayName = System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 (Fully-specified) LOG: Appbase = file:///C:/inetpub/wwwroot/GranittService/ LOG: Initial PrivatePath = C:\inetpub\wwwroot\GranittService\bin Calling assembly : System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. === LOG: This bind starts in default load context. LOG: Using application configuration file: C:\inetpub\wwwroot\GranittService\web.config LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config. LOG: Post-policy reference: System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/granittservice/573ec422/2e9e1d06/System.Web.Mvc.DLL. LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/granittservice/573ec422/2e9e1d06/System.Web.Mvc/System.Web.Mvc.DLL. LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/GranittService/bin/System.Web.Mvc.DLL. LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/GranittService/bin/System.Web.Mvc/System.Web.Mvc.DLL. LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/granittservice/573ec422/2e9e1d06/System.Web.Mvc.EXE. LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/granittservice/573ec422/2e9e1d06/System.Web.Mvc/System.Web.Mvc.EXE. LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/GranittService/bin/System.Web.Mvc.EXE. LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/GranittService/bin/System.Web.Mvc/System.Web.Mvc.EXE.

Note that the calling assembly is System.Web. Yes, WCF Data Service depends on System.Web, but System.Web doesn't depend on System.Web.Mvc, neiter does other assemblies our service uses (this is a fairly basic WCF Data Service app exposing a database as OData feed). What can require System.Web.Mvc?

1

1 Answers

0
votes

You might want to check your web.config for assemblyBinding redirects to a version of MVC which isn't installed (4.0, in your case): /configuration/runtime/assemblyBinding:

  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
  </dependentAssembly>

If you don't need MVC, you could try removing the config elements, or any MVC references in your project and see if it builds (and tests).