在 IIS 上使用 .NET Core 运行 ASP.NET 5 (MVC 6) [英] Run ASP.NET 5 (MVC 6) using .NET Core on IIS

查看:28
本文介绍了在 IIS 上使用 .NET Core 运行 ASP.NET 5 (MVC 6)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在 Visual Studio.NET 2015 RC 上创建了一个快速的 ASP.NET 5 MVC 6 应用程序,并希望它在我的 Windows 7 上的 IIS Web 服务器上运行.

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.

通常,当我在 IIS 上创建网站时,我需要选择一个应用程序池,v2.0 或 v4.0 集成.

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

现在,因为 .NET Core 的所有库都作为 nuget 包提供,我该如何在 IIS 上运行它?我选择哪个应用程序池?这是如何工作的?

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?

推荐答案

更新

正如@wickdninja 所说,以下内容已过时.使用他更新的解决方案:https://docs.microsoft.com/en-us/aspnet/core/publishing/iis使应用程序在 IIS 上运行:

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. 在 v4.0 应用程序池下创建网站.

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

使用 dnu publish 捆绑/发布应用程序.这将创建一个包含应用程序、运行时和所有依赖项的自包含包.更改运行时名称以匹配您选择的运行时.

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

如果您不希望应用程序每次启动时都从源代码编译,您甚至可以传递 --no-source.

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

复制网站根目录下的包(来自 binoutput).

Copy the bundle (from binoutput) under the website root.

运行

可能出错的事情:

  1. IIS 位数(32/64 位)必须与 coreclr 的位数匹配.
  2. 如果您不将捆绑的网站复制到网站根目录下,请确保运行 IIS 的帐户可以实际访问运行时文件夹.

这篇关于在 IIS 上使用 .NET Core 运行 ASP.NET 5 (MVC 6)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆