POST POST

JUL
31
2015

Launching an ASP.NET 5 Application From Visual Studio 2015

ORIGINALLY POSTED TO: http://jameschambers.com/2015/07/launching-an-asp-net-5-application-from-visual-studio-2015/

If you are trying to use any DNX (DotNet Execution) runtime other than dnx451 (i.e. dnx452, dnx46) you will run into the following error when running the application from Visual Studio 2015, when used with the initial release of the Beta 6 tooling:

The current runtime target framework is not compatible with 'YourWebApplication'.

Current runtime Target Framework: 'DNX,Version=v4.5.1 (dnx451)'
Type: CLR
Architecture: x64
Version: 1.0.0-beta6-12256

If you're instead running with a debugger attached, you won't hit a breakpoint, you'll only get a 500. It doesn't matter what framework runtimes you have installed on your machine. It doesn't matter what your global.json says or what dependencies or frameworks you take or specify in project.json.

This is because the default runtime for launching IIS Express from Visual Studio is indeed dnx451. You can get around this in one of two ways:

  1. Launch the website from the command line in your project directory using the command "dnx . web". Web is a command that is exposed in your project.json and shares the needed info (config) to launch a project-specific instance of IIS.
  2. In your project properties (right-click, properties from Solution Explorer), add the following environment variable in the Debug tab:
         DNX_IIS_RUNTIME_FRAMEWORK = dnx46

image

A huge thanks goes out to Andrew Nurse for providing a resolution on this matter and responding to my issue on GitHub.


James Chambers

Email Email
Web Web
Twitter Twitter
GitHub GitHub
LinkedIN LinkedIn
RSS

Looking for someone else?

You can find the rest of the Western Devs Crew here.

© 2015 Western Devs. All Rights Reserved. Design by Karen Chudobiak, Graphic Designer