Run ASP.NET 5 (MVC 6) using .NET Core on IIS

15,923

Solution 1

Update

As @wickdninja stated, the below is outdated. Use his updated solution instead: https://docs.microsoft.com/en-us/aspnet/core/publishing/iis To get the application to run on IIS:


  1. Create a website under a v4.0 app pool.

  2. Bundle/publish the application using dnu publish. This will create a self contained package that has the application, the runtime and all the dependencies. Change the runtime name to match the runtime of your choice.

      dnu publish --runtime dnx-coreclr-win-x86.1.0.0-beta5-11625
    

    You can even pass --no-source if you don't want the application to be compiled from sources every time it starts.

  3. Copy the bundle (from bin\output) under the website root.

  4. Run

Things that might go wrong:

  1. The IIS bitness (32/64 bit) must match the bitness of coreclr.
  2. If you don't copy the bundled website under the website root, make sure the account under which IIS runs can actually access the runtime folder.

Solution 2

This question is out of date, and Microsoft has since release pretty thorough documentation for this scenario. You can find it here: https://docs.microsoft.com/en-us/aspnet/core/publishing/iis

Share:
15,923
Cindro
Author by

Cindro

Updated on June 22, 2022

Comments

  • Cindro
    Cindro almost 2 years

    I have just created a quick ASP.NET 5 MVC 6 app on Visual Studio.NET 2015 RC and would like it to run on my IIS web server on Windows 7.

    Normally, when I create a website on IIS, I need to choose an Application Pool, either v2.0 or v4.0 Integrated.

    Now because .NET Core comes with all its libraries as nuget packages, how can I run it on IIS? which application pool do I pick? how does this work?

  • vcsjones
    vcsjones about 9 years
    One last thing that can go wrong is using a runtime that the rest of the packages don't like during the beta stage. As of writing, the coreclr is on beta4 on nuget, and beta5 on myget.org pre-release. If your packages are coming from nuget, packages like Microsoft.AspNet.Mvc are on beta4, and in my experience won't run on the beta5 coreclr since a lot of breaking changes are being made.
  • Cindro
    Cindro about 9 years
    Thank you, I finally got it to work. I just had to publish the site under .NET Core x64 architecture instead of x86 and it worked.
  • Baga
    Baga about 8 years
    Here it is suggested to use 'No Managed Code' for app pool.
  • MichaelMao
    MichaelMao about 8 years
    Hi how can I get runtime list? I don't know which runtime should I use
  • crthompson
    crthompson over 7 years
    There are probably a fair number of points in it for you if you summarize the article. Pointing to documentation on SO is usually frowned upon
  • wickdninja
    wickdninja over 7 years
    @paqogomez Thanks for the advice. I agree, I could get more points for summarizing the documentation, but since the new docs.microsoft.com/en-us/aspnet/core/publishing/iis is a generated document and anyone can contribute to it via the "edit" button on the page I would image that any summary I would provide would just as quickly become out dated. When it comes to documentation I'd rather give people accurate information rather than get greedy for points. :)
  • crthompson
    crthompson over 7 years
    Well, that misses the point of SO. On SO we are never sure if a link is going to be outdated, and we're not sure if information is current. So, we summarize instead of linking and do our best to keep up on our posts and keep the information updated. Happy SO'ing
  • wickdninja
    wickdninja almost 7 years
    this answer is outdated. See link to docs below for updated info