Missing MVC Assembly
newUser
Posted on
Jul 08 2014
I cannot compile my solution due to below error.
I tested it without the Raygun nuget package and it does work (I uninstalled the package and commented out all raygun references from web.config).
I did modify my web.config to accept all MVC versions without success.
I am using Sitefinity CMS, MVC 4 and ASP.NET 4.
Server Error in '/' Application.
Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
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.IO.FileLoadException: Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
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=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.
=== Pre-bind state information === LOG: DisplayName = System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 (Fully-specified) LOG: Appbase = file:///C:/Projects/PTAGISWEB04/Dev/ LOG: Initial PrivatePath = C:\Projects\PTAGISWEB04\Dev\bin
Calling assembly : Mindscape.Raygun4Net, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null.
LOG: This bind starts in default load context. LOG: Using application configuration file: C:\Projects\PTAGISWEB04\Dev\web.config LOG: Using host configuration file: C:\Users\sdudek.PSMFC.ORG\Documents\IISExpress\config\aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Post-policy reference: System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/0e7a1141/f6761f9f/System.Web.Mvc.DLL. LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/0e7a1141/f6761f9f/System.Web.Mvc/System.Web.Mvc.DLL. LOG: Attempting download of new URL file:///C:/Projects/PTAGISWEB04/Dev/bin/System.Web.Mvc.DLL. WRN: Comparing the assembly name resulted in the mismatch: Major Version ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
Stack Trace:
[FileLoadException: Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)] Mindscape.Raygun4Net.RaygunHttpModule.Init(HttpApplication context) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net4\RaygunHttpModule.cs:31 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +418 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
[HttpException (0x80004005): Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9885060 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34009
Jason Fauchelle
Raygun
Posted on
Jul 08 2014
Hello
Sorry for the trouble you've been having with including Raygun4Net. I tried reproducing this in a new Sitefinity CMS , MVC 4, ASP.NET 4 application, but the project compiles and runs fine. We will continue to look into this for you though. In the mean time, you could try creating a new Sitefinity application and see if Raygun4Net works happily in that. This may help narrow down the problem.
-Jason Fauchelle
newUser
Posted on
Jul 09 2014
I cannot start fresh. I need to implement raygun into my existing application.
I will look into the problem on my side in more details.
Stonemonk
Posted on
Jul 10 2014
I encountered a similar issue when I was adding Raygun to a WCF project, I simply added the MVC Nuget Package and it brought over the required assemblies. I'm surprised the Raygun Nuget package doesn't have the MVC nuget package as a dependency.
Jason Fauchelle
Raygun
Posted on
Jul 10 2014
@newUser My apologies, I wasn't meaning that you should start from scratch, I was thinking if you create a temporary brand new Sitefinity CMS application and integrate Raygun into that to send a test exception, does that produce the same problem? Knowing whether or not this works may help us to reproduce the issue at our end.
@Stonemonk The Raygun4Net package is designed to work in a large variety of .Net projects. This includes WPF applications, console apps, WinForms and ASP.Net MVC apps. This is why we haven't given dependencies on the NuGet package, as we wouldn't want to install MVC into everyone's WPF applications for example. All of the types of applications that we've created in Visual Studio have included all the required assemblies for the different bits of Raygun4Net to just work. Creating an ASP.Net MVC app for example includes an appropriate version of MVC which Raygun4Net happily works with. I hadn't tried a WCF project though. I hope this explains the approach that we have taken.
-Jason Fauchelle
Cuinn Wylie
Posted on
Jul 14 2014
Hey,
I had this problem too. Added the latest raygun4net nuget package to my asp.net web project and boom! all sorts of warnings about requiring mvc components.
So I went and downloaded the latest release from github and installed the raygun4net dll from the root of download and all working. If I add in the Net4 dll then it starts wanting mvc again.
Cuinn.
jeremy
Raygun
Posted on
Jul 15 2014
Can you check you have a binding redirect specified for MVC in your web.config?
e.g.
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Replace 4.0.0.0 with 5.0.0.0 if you are targeting MVC 5.
Jeremy
newUser
Posted on
Jul 16 2014
@Jeremy I was missing that redirect in web.config. However after adding it, the problem was still there.
@Cuinn Wylie
That worked!
I got the latest from GitHub, compiled code in my environment and then referenced the new dll in my existing solution.
Thank you all for help.
GLBrad
Posted on
Jul 25 2014
I am getting this error on a WPF application. Even updated to latest 3.1 Raygun4Net and this still has the issue. Application is throwing the System.Web.MVC missing exception. Hopefully this can be fixed. Getting a bit urgent as I need to deploy in the next day or two.
If no one has a solutions, sounds like maybe I'll have to pull the source code down and see if I can resolve.
b r a d
Jason Fauchelle
Raygun
Posted on
Jul 25 2014
Hello Brad
Apologies for this issue, we've never seen this occur in a WPF application before. The Raygun4Net dll that targets .Net 4.0 does contain references to MVC 3.0, but it should not be a problem as long as you don't use the RaygunHttpModule, or the RaygunExceptionFilterAttribute classes.
One way to fix this is to get the dlls from GitHub, and use the Raygun4Net dll from the root folder. This targets .Net 3.5 and does not reference MVC. https://github.com/MindscapeHQ/raygun4net/releases
We will look at resolving this reference issue when installing via NuGet.
-Jason Fauchelle
ulf@CAB
Posted on
Aug 14 2014
We also have this issue, and in our case the "reason" is that we scan all assemblies in the program directory looking for ones that have types that implements certain interfaces. (i.e Plugin scanning where we do not control the naming of the assemblies)
Executing GetTypes() on the .Net 4 RayGun assembly forces loading of those references since the classes you mention are "used" at that time.
The workaround was to use other kinds of filtering on what assemblies are loaded during plugin scanning.
/Ulf
Jason Fauchelle
Raygun
Posted on
Aug 14 2014
Thanks for this feedback Ulf
We will be looking into a solution to these dependency issues soon, so that Raygun4Net will just work in any of these scenarios without requiring workarounds.
-Jason Fauchelle
benmills
Posted on
Aug 23 2014
I think I'm having the same (or at least a similar) problem. I tried to add Raygun to a WPF project via nuget. Everything builds and I'm able to publish the application, but when users try to install the latest version, they get messages about needing Microsoft.Web.Infrastructure in the GAC. I fixed that and then it wants MVC in the GAC.
I believe that I can set these DLLs to publish with the application, but installing MVC in the GAC for an application that is not even web related seems a bit icky. I think I'll want for the fix - hopefully a nuget package with no reference to MVC.
Jason Fauchelle
Raygun
Posted on
Aug 27 2014
Thanks for the feedback and sorry for the issues here. We'll certainly be fixing this soon.
-Jason Fauchelle
Robert T
Posted on
Sep 22 2014
I am having this error as well after upgrading MVC to 5.2.2.0 and upgrading Raygun to 3.3.2. It runs locally but fails on our server.
newUser
Posted on
Oct 23 2014
I just updated my solution to the newest version of raygun.
It did compile. However, when I started the debug process it broke with the same error.
I am using Mindscape.Raygun4Net.Mvc version 4
Server Error in '/' Application.
Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
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.IO.FileLoadException: Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
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=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.
=== Pre-bind state information ===
LOG: DisplayName = System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///C:/Projects/PTAGISWEB04/Dev/
LOG: Initial PrivatePath = C:\Projects\PTAGISWEB04\Dev\bin
Calling assembly : Mindscape.Raygun4Net.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Projects\PTAGISWEB04\Dev\web.config
LOG: Using host configuration file: C:\Users\sdudek.PSMFC.ORG\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/0e7a1141/f6761f9f/System.Web.Mvc.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/0e7a1141/f6761f9f/System.Web.Mvc/System.Web.Mvc.DLL.
LOG: Attempting download of new URL file:///C:/Projects/PTAGISWEB04/Dev/bin/System.Web.Mvc.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
Stack Trace:
[FileLoadException: Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
Mindscape.Raygun4Net.RaygunHttpModule.Init(HttpApplication context) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net.Mvc\RaygunHttpModule.cs:31
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +418
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
[HttpException (0x80004005): Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9930508
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34212
Jason Fauchelle
Raygun
Posted on
Oct 23 2014
Hello,
If your project is using MVC 4, then I would expect that a binding redirect would work fine - this solves the problem at my end:
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
This is something that I'll see if we can get sorted automatically in the next version.
If this does not resolve the issue, you could continue using the standard Raygun4Net package when version 4 is released next Monday. This will be the equivalent of the previous solution that you may have been using that was to manually use the Raygun4Net dll from the root folder of the GitHub release download. But now that the MVC references will have been removed from the main Raygun4Net package next Monday, you won't need to reference the dll manually, and will be able to use the Raygun4Net NuGet package instead.
-Jason Fauchelle
Jason Fauchelle
Raygun
Posted on
Oct 28 2014
To everyone following this thread, Raygun4Net version 4 has now been released which solves the dependency issues. If you are using Raygun in an MVC or/and WebApi project, you'll now want to use the new Raygun4Net.Mvc or/and Raygun4Net.WebApi NuGet packages. For everyone else, you'll want to upgrade to version 4 of the standard Raygun4Net package which no longer has MVC and WebApi references.
-Jason Fauchelle