asp.net core程序发布(Webapi,web网站)

孤者浪人 提交于 2020-04-12 13:49:21

asp.net core程序发布(Webapi,web网站)

iis 下发布asp.net core 应用
1.下载AspNetCoreModuleV2 安装 ASP.NET Core 2.2 Runtime (v2.2.2) - Windows Hosting Bundle Installe
2.在vs2019项目里发布应用;
3.在iis上新建无托管代码应用程序池
4.添加网站,物理路径指向刚发布的应用。




2.asp.net 命令行发布:
1.在项目bin/debug or release netcoreapp3.1文件夹下执行 cmd

2.在cmd窗口执行:dotnet aaa.dll --urls="http://*:5177" --ip="127.0.0.1" --port=5177
--YQF.Pay.dll 为controller项目名称

3.在startup.cs configure 方法里添加:
//让通过命令行发布的程序,css,js,img可以显示
app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot"))
});




 

 

https://dotnet.microsoft.com/download/dotnet-core/thank-you/runtime-aspnetcore-2.2.2-windows-hosting-bundle-installer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!