如何配置ASP.NET Core 1.0以使用本地IIS而不是IIS Express?

编程入门 行业动态 更新时间:2024-10-10 09:20:10
本文介绍了如何配置ASP.NET Core 1.0以使用本地IIS而不是IIS Express?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何在调试时设置 .Net Core 1.0 项目以使用本地IIS 而不是 IIS Express ?

How can I setup a .Net Core 1.0 project to use Local IIS instead of IIS Express when debugging?

我尝试过以各种方式修改 launchSettings.json 文件。例如,将所有出现的 IIS Express 替换为本地IIS 并更新 applicationUrl 和 launchUrl 以使用我的自定义localhost http://sample.local (我已更新主机文件并已配置IIS管理器)但不满意。

I have tried modifying launchSettings.json file in various ways. For example, replacing all occurrences of IIS Express with Local IIS and updating the applicationUrl and launchUrl to use my custom localhost sample.local (I have updated the host file and configured IIS manager already) but not happy.

属性/ launchSettings.json 文件的默认设置:

{ "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "localhost:38601/", "sslPort": 0 } }, "profiles": { "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "SampleApp": { "commandName": "Project", "launchBrowser": true, "launchUrl": "localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } } } }

推荐答案

您目前无法直接使用IIS来托管ASP.NET Core appli开发时阳离子,因为开发文件夹不提供IIS需要托管的所有必要文件。这使得在开发环境中运行ASP.NET Core有点痛苦。

You currently cannot directly use IIS to host an ASP.NET Core application while developing, as the development folder does not provide all of the necessary files IIS needs to host. This makes running an ASP.NET Core in a development environment a bit of a pain.

正如 Rick Strahl的这篇文章,没有太多理由尝试这样做。运行ASP.NET核心应用程序时IIS几乎没有 - 实际上您的应用程序不再直接在IIS进程中运行,而是在托管Kestrel Web服务器的完全独立的控制台应用程序中运行。因此,当您自行托管您的控制台应用程序时,您确实在基本相同的环境中运行。

As pointed out in this article by Rick Strahl, there aren't many reasons to try and do this. IIS does very little when running ASP.NET Core apps - in fact your application no longer runs directly in the IIS process, instead it runs in a completely separate console application hosting the Kestrel web server. Therefore you really are running in essentially the same environment when you self host your console application.

如果做需要发布您的应用程序,可以使用 dotnet 命令行或使用Visual Studio工具对本地文件夹执行此操作。

If you do need to publish your app, you can do so to a local folder, using either the dotnet command line, or using the Visual Studio tools.

例如,如果要发布到 C:\ output 文件夹,可以使用以下命令:

For example, if you want to publish to the C:\output folder, you can use the following command:

dotnet publish --framework netcoreapp1.0 --output "c:\temp\AlbumViewerWeb" --configuration Release

然后,您可以将IIS站点指向输出文件夹。确保将应用程序池CLR版本设置为 No Managed Code 并且 AspNetCoreModule 可用。

You can then point your IIS Site at the output folder. Ensure that you set the application pool CLR version to No Managed Code and that the AspNetCoreModule is available.

有关详细信息,请参阅 docs.asp/en/latest/publishing/iis.html

For more details, see docs.asp/en/latest/publishing/iis.html

更多推荐

如何配置ASP.NET Core 1.0以使用本地IIS而不是IIS Express?

本文发布于:2023-11-07 15:28:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1566822.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:而不是   Core   NET   ASP   Express

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!