我怎样才能设置一个.Net核心1.0项目使用本地IIS代替IIS 快递调试时?
我尝试过修改启动设置.json以各种方式归档。例如,替换所有出现的IIS 快递 with 本地IIS并更新应用程序网址 and 启动网址使用我的自定义本地主机http://sample.local http://sample.local(我已经更新了主机文件并配置了 IIS 管理器)但不满意。
默认设置为属性/launchSettings.json file:
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:38601/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"SampleApp": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
目前,您在开发时无法直接使用 IIS 托管 ASP.NET Core 应用程序,因为开发文件夹不提供 IIS 需要托管的所有必需文件。这使得 ASP.NET Core 运行在发展环境有点痛苦。
正如指出的瑞克·斯特拉尔的这篇文章 https://weblog.west-wind.com/posts/2016/Jun/06/Publishing-and-Running-ASPNET-Core-Applications-with-IIS#RunningIISasaDevelopmentServer-no,没有太多理由尝试这样做。运行 ASP.NET Core 应用程序时,IIS 执行的操作很少 - 事实上,您的应用程序不再直接在 IIS 进程中运行,而是在托管 Kestrel Web 服务器的完全独立的控制台应用程序中运行。因此,当您自行托管控制台应用程序时,您实际上是在本质上相同的环境中运行。
If you do需要发布您的应用程序,您可以使用以下任一方法将其发布到本地文件夹dotnet
命令行,或使用 Visual Studio 工具。
例如,如果您想发布到C:\output
文件夹中,可以使用以下命令:
dotnet publish
--framework netcoreapp1.0
--output "c:\temp\AlbumViewerWeb"
--configuration Release
然后,您可以将 IIS 站点指向输出文件夹。确保将应用程序池 CLR 版本设置为无托管代码并且那AspNetCore模块 http://go.microsoft.com/fwlink/?LinkId=798480可用。
有关更多详细信息,请参阅https://docs.asp.net/en/latest/publishing/iis.html https://docs.asp.net/en/latest/publishing/iis.html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)