Couldn't determine an appropriate version of runtime to run

拜拜、爱过 提交于 2019-12-23 02:18:27

问题


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:

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

Here is the output from 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

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.

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

How do I resolve it?

Thanks.

Cross reference on ASP.NET Forums


回答1:


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.

Snippet:

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



来源:https://stackoverflow.com/questions/30081380/couldnt-determine-an-appropriate-version-of-runtime-to-run

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!