本文介绍了无法确定要运行的适当版本的运行时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚完成升级到beta4.我的代码可以成功编译,没有错误/警告,但是我无法启动IIS Express中托管的Web api(通过点击F5).我收到以下错误:

I just finished upgrading to beta4. My code compiles successfully with no errors/warnings but I am unable to launch my web api hosted in IIS Express (by hitting F5). I get the following error:

描述:执行以下操作时发生未处理的异常 当前的Web请求.请查看堆栈跟踪以获取更多信息 有关错误及其在代码中起源的信息.

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.

异常详细信息:System.InvalidOperationException:无法 确定要运行的适当版本的运行时.看 http://go.microsoft.com/fwlink/?LinkId=517742 了解更多信息.

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.

源错误:

在执行过程中生成了未处理的异常 当前的Web请求.有关原产地和位置的信息 可以使用下面的异常堆栈跟踪来识别异常.

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.

堆栈跟踪:

[InvalidOperationException:无法确定合适的版本 运行时间.请参阅 http://go.microsoft.com/fwlink/?LinkId=517742 欲获得更多信息.] System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags HostingFlags,PolicyLevel,policyLevel,Exception appDomainCreationException)+303

[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):无法确定合适的版本 运行时间.请参阅 http://go.microsoft.com/fwlink/?LinkId=517742 欲获得更多信息.] System.Web.HttpRuntime.FirstRequestInit(HttpContext上下文)+9940016 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext上下文) +101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr,HttpContext上下文)+261

[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

版本信息:Microsoft .NET Framework版本:4.0.30319; ASP.NET版本:4.6.57.0

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

这是dnvm list的输出:

活动版本运行时体系结构位置别名

Active Version Runtime Architecture Location Alias

  • 1.0.0-beta4 clr x64 C:\ Users \ dpeden.dnx \ runtimes默认值
    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
  • 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),这似乎没有任何作用.

I have also tried explicitly setting the runtime (Use Specific Runtime on the Debug tab of the project properties) which appears not to have any effect.

从VS 2015 CTP 6和beta3升级到VS 2015 RC和beta4之前,我没有这个问题.

I did not have this issue prior to upgrading to VS 2015 RC and beta4 from VS 2015 CTP 6 and beta3.

我该如何解决?

谢谢.

ASP.NET论坛上的交叉引用

推荐答案

原来,这是一个简单的问题.在阅读 https://github.com/aspnet/Announcements/issues/3 之后,我意识到我已经将aspnet50更改为dnx46,而应该将其更改为dnx451.在所有project.json文件中进行了更改之后,我的问题已解决.

It turns out that it was a simple problem. After reading https://github.com/aspnet/Announcements/issues/3, I realized that I had changed aspnet50 to dnx46 whereas it should have been dnx451. After making that change in all of my project.json files, my issue was resolved.

摘要:

框架":{ "dnx451":{}}

"frameworks": { "dnx451": {}},

这篇关于无法确定要运行的适当版本的运行时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-09 21:46