简体   繁体   English

如何在 IIS 中托管 asp.net core MVC 应用程序?

[英]How to host a asp.net core MVC app in IIS?

I am familiar with .Net in general but new to ASP.Net Core.我一般熟悉 .Net,但对 ASP.Net Core 不熟悉。 I just had my first "self-hosted" ASP.Net Core MVC app running (created using templet and runs under Kestrel by default) .我刚刚运行了我的第一个“自托管”ASP.Net Core MVC 应用程序(使用模板创建并默认在 Kestrel 下运行)。 What I would like to do now it to host it in-process with IIS.我现在想做的是在 IIS 中托管它。 But what I am struggling with is that I couldn't seem to find a clear and detailed instruction/document about what I need to do to get it to work.但是我正在努力解决的是,我似乎无法找到关于我需要做什么才能使其工作的清晰详细的说明/文档。 I have tried various configuration changes on my own but nothing works so far.我自己尝试了各种配置更改,但到目前为止没有任何效果。 I am running .Net Core 3.1 and using VS.Net 2019 on my Windows 10 environment.我正在运行 .Net Core 3.1 并在我的 Windows 10 环境中使用 VS.Net 2019。 If someone could point me to the right direction it would be highly appreciated.如果有人能指出我正确的方向,我将不胜感激。

As far as I know, if you want to host the asp.net core application on the IIS.据我所知,如果您想在 IIS 上托管 asp.net 核心应用程序。 You should make sure you have installed the right hosting bundle.您应该确保安装了正确的托管包。

Notice: No matter you use in-process or out-of-process, you all need install the IIS hosting bundle.注意:无论您使用进程内还是进程外,您都需要安装 IIS 托管包。

More details about how to install it, you could refer to this link .有关如何安装它的更多详细信息,您可以参考此链接

After install the link, you could check your IIS module to make sure you have installed the right asp.net core module.安装链接后,您可以检查您的 IIS 模块以确保您安装了正确的 asp.net 核心模块。

在此处输入图片说明

Then you could use VS to publish the application to right folder and create the IIS web site as below:然后你可以使用 VS 将应用程序发布到正确的文件夹并创建 IIS 网站,如下所示:

在此处输入图片说明

在此处输入图片说明

Create IIS website:创建 IIS 网站:

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM