1、发布项目
2、下载并安装AspNetCoreModuleV2模块
下载地址:https://dotnet.microsoft.com/download/dotnet-core/thank-you/runtime-aspnetcore-2.2.2-windows-hosting-bundle-installer

下载页面
3、当打开IIS面板,在模块里有AspNetCoreModuleV2时表示安装成功
4、添加网站并配置发布的路径、ip、端口等信息
5、将运用程序池.NET CLR版本选择为无托管代码
6、访问时如果报500缺点,则先打开拓布文件夹里的web.cinfig文件,修正stdoutLogEnabled="true",根据缺点日志定位详细缺点
7、常见问题——数据库连接失落败,可能是数据库连接字符串有问题
例如缺点提示:You shouldn't use localdb when hosting in IIS. LocalDB is launched in the context of the user running it.(在IIS中托管时不应该利用localdb。LocalDB是在运行它的用户的高下文中启动的。)
修正数据库连接字符串:
精确配置:"shopConnectionString": "server=.;database=ShopDB;uid=sa;pwd=123"
缺点配置:"Server=PS20190608PCTW;DataBase=ShopDB;Trusted_Connection=True;"(本地可以访问,发布到IIS 不能访问)
8、修正完数据库连接字符串后再次访问成功