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

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 YQF.Pay.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

猜你喜欢

转载自www.cnblogs.com/csj007523/p/12681405.html