我今天早上升级到VS2015 RC,我使用ASP.NET 5模板 - 网站创建了一个新项目。我有一个错误,我无法解决:
处理请求时发生未处理的异常。
MissingMethodException:找不到方法: '系统 .Collections.Immutable.ImmutableArray`1 Microsoft.CodeAnalysis.Emit.EmitResult.get_Diagnostics()'
Microsoft.AspNet.Mvc.Razor.RoslynCompilationService.Compile(RelativeFileInfo fileInfo,String compilationContent)
这是完整的错误堆栈:
MissingMethodException:找不到方法: ' System.Collections.Immutable.ImmutableArray`1 Microsoft.CodeAnalysis.Emit.EmitResult.get_Diagnostics()'
Microsoft.AspNet.Mvc.Razor.RoslynCompilationService.Compile(RelativeFileInfo fileInfo,String compilationContent)
Microsoft.AspNet.Mvc.Razor.RazorCompilationService.Compile(RelativeFileInfo 文件)
Microsoft.AspNet.Mvc.Razor.CompilerCache.OnCacheMiss(RelativeFileInfo file,String normalizedPath,Func`2 compile)
Microsoft.AspNet.Mvc.Razor.CompilerCache.GetOrAddCore(字符串 relativePath,Func`2编译)
Microsoft.AspNet.Mvc.Razor.CompilerCache.GetOrAdd(String relativePath, Func`2编译)
Microsoft.AspNet.Mvc.Razor.VirtualPathRazorPageFactory.CreateInstance(字符串 relativePath)
Microsoft.AspNet.Mvc.Razor.RazorViewEngine.LocatePageFromViewLocations(ActionContext中 context,String pageName,Boolean isPartial)
Microsoft.AspNet.Mvc.Razor.RazorViewEngine.GetRazorPageResult(ActionContext中 context,String pageName,Boolean isPartial)
Microsoft.AspNet.Mvc.Razor.RazorViewEngine.FindView(ActionContext中 context,String viewName)
Microsoft.AspNet.Mvc.Rendering.CompositeViewEngine.FindView(ActionContext中 context,String viewName,Boolean partial)
Microsoft.AspNet.Mvc.Rendering.CompositeViewEngine.FindView(ActionContext中 context,String viewName)
Microsoft.AspNet.Mvc.ViewResult.d__20.MoveNext()
---抛出异常的前一个位置的堆栈跟踪结束---
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
Microsoft.AspNet.Mvc.Core.FilterActionInvoker.d__44.MoveNext()
---抛出异常的前一个位置的堆栈跟踪结束---
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
Microsoft.AspNet.Mvc.Core.FilterActionInvoker.d__43.MoveNext()
---抛出异常的前一个位置的堆栈跟踪结束---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Microsoft.AspNet.Mvc.Core.FilterActionInvoker.d__42.MoveNext()
---抛出异常的前一个位置的堆栈跟踪结束---
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
Microsoft.AspNet.Mvc.Core.FilterActionInvoker.d__37.MoveNext()
---抛出异常的前一个位置的堆栈跟踪结束---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Microsoft.AspNet.Mvc.Core.FilterActionInvoker.d__32.MoveNext()
---抛出异常的前一个位置的堆栈跟踪结束---
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
Microsoft.AspNet.Mvc.MvcRouteHandler.d__3.MoveNext()
---抛出异常的前一个位置的堆栈跟踪结束---
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
Microsoft.AspNet.Mvc.MvcRouteHandler.d__2.MoveNext()
---抛出异常的前一个位置的堆栈跟踪结束---
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
Microsoft.AspNet.Routing.Template.TemplateRoute.d__25.MoveNext()
---抛出异常的前一个位置的堆栈跟踪结束---
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
Microsoft.AspNet.Routing.RouteCollection.d__10.MoveNext()
---抛出异常的前一个位置的堆栈跟踪结束---
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
Microsoft.AspNet.Builder.RouterMiddleware.d__4.MoveNext()
---抛出异常的前一个位置的堆栈跟踪结束---
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
Microsoft.AspNet.Authentication.AuthenticationMiddleware`1.d__10.MoveNext()
---抛出异常的前一个位置的堆栈跟踪结束---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Microsoft.AspNet.Authentication.AuthenticationMiddleware`1.d__10.MoveNext()
---抛出异常的前一个位置的堆栈跟踪结束---
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
Microsoft.AspNet.Authentication.AuthenticationMiddleware`1.d__10.MoveNext()
---抛出异常的前一个位置的堆栈跟踪结束---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Microsoft.AspNet.Authentication.AuthenticationMiddleware`1.d__10.MoveNext()
---抛出异常的前一个位置的堆栈跟踪结束---
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
Microsoft.AspNet.Authentication.AuthenticationMiddleware`1.d__10.MoveNext()
---抛出异常的前一个位置的堆栈跟踪结束---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Microsoft.AspNet.Authentication.AuthenticationMiddleware`1.d__10.MoveNext()
---抛出异常的前一个位置的堆栈跟踪结束---
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
Microsoft.AspNet.Authentication.AuthenticationMiddleware`1.d__10.MoveNext()
---抛出异常的前一个位置的堆栈跟踪结束---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Microsoft.AspNet.Authentication.AuthenticationMiddleware`1.d__10.MoveNext()
---抛出异常的前一个位置的堆栈跟踪结束---
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
System.Threading.Tasks.EntityFrameworkTaskExtensions.CultureAwaiter.GetResult()
Microsoft.AspNet.Diagnostics.Entity.DatabaseErrorPageMiddleware.d__6.MoveNext()
---抛出异常的前一个位置的堆栈跟踪结束---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Microsoft.AspNet.Diagnostics.Entity.DatabaseErrorPageMiddleware.d__6.MoveNext()
---抛出异常的前一个位置的堆栈跟踪结束---
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
Microsoft.AspNet.Diagnostics.ErrorPageMiddleware.d__4.MoveNext()
我的project.json文件与模板中提供的文件相同:
{
"webroot": "wwwroot",
"userSecretsId": "aspnet5-WebApplication2-2819f43f-7688-4637-89a0-d22341b36a64",
"version": "1.0.0-*",
"dependencies": {
"EntityFramework.SqlServer": "7.0.0-beta4",
"EntityFramework.Commands": "7.0.0-beta4",
"Microsoft.AspNet.Mvc": "6.0.0-beta4",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta4",
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-beta4",
"Microsoft.AspNet.Authentication.Facebook": "1.0.0-beta4",
"Microsoft.AspNet.Authentication.Google": "1.0.0-beta4",
"Microsoft.AspNet.Authentication.MicrosoftAccount": "1.0.0-beta4",
"Microsoft.AspNet.Authentication.Twitter": "1.0.0-beta4",
"Microsoft.AspNet.Diagnostics": "1.0.0-beta4",
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-beta4",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta4",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta4",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta4",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta4",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-beta4",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4",
"Microsoft.Framework.ConfigurationModel.UserSecrets": "1.0.0-beta4",
"Microsoft.Framework.CodeGenerators.Mvc": "1.0.0-beta4",
"Microsoft.Framework.Logging": "1.0.0-beta4",
"Microsoft.Framework.Logging.Console": "1.0.0-beta4",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta4"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000",
"gen": "Microsoft.Framework.CodeGeneration",
"ef": "EntityFramework.Commands"
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
},
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
],
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
],
"scripts": {
"postrestore": [ "npm install", "bower install" ],
"prepare": [ "gulp copy" ]
}
}
当我运行dnvm list命令时:
> dnvm list
Active Version Runtime Architecture Location Alias
------ ------- ------- ------------ -------- -----
1.0.0-beta4 clr x64 <mypath>\.dnx\packages
1.0.0-beta4 clr x86 <mypath>\.dnx\packages
1.0.0-beta4 coreclr x64 <mypath>\.dnx\packages
1.0.0-beta4 coreclr x86 <mypath>\.dnx\packages
1.0.0-beta5-11596 clr x86 <mypath>\.dnx\packages
* 1.0.0-beta5-11624 clr x86 <mypath>\.dnx\packages default
我尝试使用1.0.0-beta5-11596和1.0.0-beta4 clr,但我得到了相同的结果。
有什么想法吗?
感谢。
答案 0 :(得分:4)
我认为大卫是对的,我有同样的问题,我能够通过以下方式解决它:
一旦我这样做,我重新打开了项目,包成功恢复,我就能运行应用程序了。无论出于何种原因,无论出于何种原因,defaults.txt都指向beta5运行时,假设这是在使用命令行工具时设置的。
希望这对你有用!