visual studio 2012 RC Não foi possível carregar o tipo System.Web.Http.RouteParameter
Eu tinha o VS 11 Beta, .net 4.5 e MVC 4 beta instalado no meu PC. Acabei de baixar o RC mais recente e agora recebo essa mensagem de erro quando tento executar projetos da web. Eu tentei reinstalar o .net 4.5 e desinstalar e reinstalar o VS 12 RC, mas isso não funcionou. Eu tentei a sugestãoAqui que não funcionou também.
Pilha
Could not load type 'System.Web.Http.RouteParameter' from assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
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.TypeLoadException: Could not load type 'System.Web.Http.RouteParameter' from assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Source Error:
Line 26: defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
Line 27: );
Line 28: }
Line 29: }
Line 30: }
Source File: c:\projects\testNew\testNew\App_Start\RouteConfig.cs Line: 28
Stack Trace:
[TypeLoadException: Could not load type 'System.Web.Http.RouteParameter' from assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.]
testNew.RouteConfig.RegisterRoutes(RouteCollection routes) in c:\projects\testNew\testNew\App_Start\RouteConfig.cs:28
testNew.MvcApplication.Application_Start() in c:\projects\testNew\testNew\Global.asax.cs:25
[HttpException (0x80004005): Could not load type 'System.Web.Http.RouteParameter' from assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9841101
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
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 type 'System.Web.Http.RouteParameter' from assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9850940
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.17626
Editar 6
eu useifuslogvw
e descobri que o projeto estava referenciando oSystem.Web.Http.dll
daqui
C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Http\v4.0_4.0.0.0__31bf3856ad364e35
em vez do meu projeto. Renomear este arquivo fez meu projeto funcionar, mas obviamente não posso fazer isso no meu site de hospedagem compartilhada.
Eu referenciei manualmente a dll de
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies
e configurá-lo paraCopy to Local
. Ainda carrega degac_msil
. Como faço para substituir isso?