无法确定运行的适当版本运行

问题描述:

我刚升级到beta4。我的代码编译成功,没有错误/警告,但我无法启动我在IIS Express中托管的web api(击中F5)。我收到以下错误:无法确定运行的适当版本运行

Couldn't determine an appropriate version of runtime to run. See http://go.microsoft.com/fwlink/?LinkId=517742 for more information.

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.InvalidOperationException: Couldn't determine an appropriate version of runtime to run. See http://go.microsoft.com/fwlink/?LinkId=517742 for more information.

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.

Stack Trace:

[InvalidOperationException: Couldn't determine an appropriate version of runtime to run. See http://go.microsoft.com/fwlink/?LinkId=517742 for more information.] System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException) +303

[HttpException (0x80004005): Couldn't determine an appropriate version of runtime to run. See http://go.microsoft.com/fwlink/?LinkId=517742 for more information.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9940016 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.57.0

这里是输出dnvm list

C:\src\web-api-skeleton [master]> dnvm list

Active Version Runtime Architecture Location Alias


  • 1.0.0-beta4 clr x64 C:\Users\dpeden.dnx\runtimes default
    1.0.0-beta4 clr x86 C:\Users\dpeden.dnx\runtimes
    1.0.0-beta4 coreclr x64 C:\Users\dpeden.dnx\runtimes
    1.0.0-beta4 coreclr x86 C:\Users\dpeden.dnx\runtimes
    1.0.0-beta4-11566 clr x86 C:\Users\dpeden.dnx\runtimes

我自己也尝试明确设置(项目属性的调试选项卡上Use Specific Runtime)运行时出现不有什么影响。

从VS 2015 CTP 6和beta3升级到VS 2015 RC和beta4之前,我没有遇到此问题。

我该如何解决?

谢谢。

Cross reference on ASP.NET Forums

事实证明,这是一个简单的问题。在阅读https://github.com/aspnet/Announcements/issues/3后,我意识到我已将aspnet50更改为dnx46,而它应该是dnx451。在对我所有的project.json文件进行更改后,我的问题已解决。

段:

“框架”:{ “dnx451”:{}} ,