2013-08-14 5 views
5

Ich bin VS 2013 ausgeführt und ich habe gerade die ASP.NET Route Debugger installiert. wenn ich versuche, es zu laufen von zu localhost Surfen im Internet: xxx/rd ich die folgende Fehlermeldung erhalten:Ausnahme nach der Installation von ASP.NET Route Debugger

[A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to [B]System.Web.WebPages.Razor.Configuration.HostSection. Type A originates from 'System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.WebPages.Razor.dll'. Type B originates from 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\Users\joshua\AppData\Local\Temp\Temporary ASP.NET Files\root\84448590\ee78b185\assembly\dl3\776eeced\61921913_e997ce01\System.Web.WebPages.Razor.dll'. 

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.InvalidCastException: [A]System. 
Web.WebPages.Razor.Configuration.HostSection cannot be cast 
to [B]System.Web.WebPages.Razor.Configuration.HostSection. Type A originates from 'System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.WebPages.Razor.dll'. Type B originates from 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\Users\joshua\AppData\Local\Temp\Temporary ASP.NET 
Files\root\84448590\ee78b185\assembly\dl3\776eeced\61921913_e997ce01\System.Web.WebPages.Razor.dll'. 

Stack Trace:

[InvalidCastException: [A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to [B]System.Web.WebPages.Razor.Configuration.HostSection. Type A originates from 'System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.WebPages.Razor.dll'. Type B originates from 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\Users\joshua\AppData\Local\Temp\Temporary ASP.NET Files\root\84448590\ee78b185\assembly\dl3\776eeced\61921913_e997ce01\System.Web.WebPages.Razor.dll'.] 
    System.Web.WebPages.Razor.WebRazorHostFactory.GetRazorSection(String virtualPath) +151 
    System.Web.WebPages.Razor.WebRazorHostFactory.CreateHostFromConfig(String virtualPath, String physicalPath) +209 
    System.Web.WebPages.Razor.WebRazorHostFactory.CreateHostFromConfig(String virtualPath) +46 
    System.Web.WebPages.Razor.RazorBuildProvider.GetHostFromConfig() +58 
    System.Web.WebPages.Razor.RazorBuildProvider.CreateHost() +62 
    System.Web.WebPages.Razor.RazorBuildProvider.get_Host() +65 
    System.Web.WebPages.Razor.RazorBuildProvider.EnsureGeneratedCode() +83 
    System.Web.WebPages.Razor.RazorBuildProvider.get_CodeCompilerType() +54 
    System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider) +59 
    System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders() +209 
    System.Web.Compilation.BuildProvidersCompiler.PerformBuild() +15 
    System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +9949713 
    System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) +299 
    System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) +103 
    System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound) +165 
    System.Web.Compilation.BuildManager.GetCompiledType(VirtualPath virtualPath) +10 
    System.Web.Compilation.BuildManager.GetCompiledType(String virtualPath) +28 
    System.Web.Mvc.BuildManagerWrapper.System.Web.Mvc.IBuildManager.GetCompiledType(String virtualPath) +47 
    System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +175 
    System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +480 
    System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +50 
    System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +123 
    System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +582 
    System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +115 
    System.Web.Mvc.Async.<>c__DisplayClass28.<BeginInvokeAction>b__19() +321 
    System.Web.Mvc.Async.<>c__DisplayClass1e.<BeginInvokeAction>b__1b(IAsyncResult asyncResult) +184 
    System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +53 
    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +140 
    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +63 
    System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +50 
    System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +45 
    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +81 
    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +146 
    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +66 
    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +50 
    System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +50 
    System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +50 
    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +73 
    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +146 
    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +66 
    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +50 
    System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +50 
    System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +50 
    System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__4(IAsyncResult asyncResult, ProcessRequestState innerState) +45 
    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +81 
    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +146 
    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +66 
    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +50 
    System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +50 
    System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +49 
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9631512 
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155 

Ich habe versucht, die Lösung here erwähnt, aber es hat nicht funktioniert. Ich habe versucht, es Version 2 und 3 zu machen.

+1

Nur eine Ahnung basierend auf der Ausnahme Nachricht. Offensichtlich scheint es einen Teil Ihres Codes zu geben, der 'System.Web.WebPages.Razor' v2.0.0.0 referenziert, während ein anderer Teil Ihres Codes auf 'System.Web.WebPages.Razor' v3.0.0.0 verweist. Könnte es sein, dass der ASP.NET Route Debugger eine Abhängigkeit von der älteren Version der .dll hat, aber Ihr Projekt die neuere verwendet? Der Beitrag, den Sie verlinkt haben, scheint eine Möglichkeit zu sein, Ihr Projekt zu zwingen, eine ältere Version zu verwenden. Sie sollten die Fehlermeldung ab dem Zeitpunkt, wenn Sie v2.0.0.0 in die Konfiguration einfügen. Könnte es sein, dass du vergessen hast, die v3.0.0.0 .dll aus deiner Ablage zu löschen? – rliu

Antwort

5

Roliu wies mich in die richtige Richtung und ich fand es heraus. Der Routendebugger hat eine Datei web.config, die auf die Version v2.0.0.0 von system.web.webpages.razor und v4.0.0.0 von mvc verweist. Ich habe alle Referenzen von Rasierer v2 auf Rasierer v3 geändert und ändert mvc 4 zu mvc 5.

+4

Fyi, diese Web.config-Datei befindet sich in Areas/RouteDebugger/Views. –

+0

Vielen Dank! – Eyal

Verwandte Themen