IIS 安装
控制面板 -> 程序 -> 启动或关闭windows功能 -> Internet Information Service (勾选所有选项)
部署
下载地址:https://dotnet.microsoft.com/download/dotnet/5.0
必须安装
点击项目,选择【发布】
点击【发布】
脚本启动
CMD运行脚本
D:DemoCodeDemoPublic>dotnet AspNetCore5Demo.dll --urls="http://localhost:66"
IIS启动
注意web.config配置
<?xml version="1.0" encoding="utf-8"?> <configuration> <!-- To customize the asp.net core module uncomment and edit the following section. For more info see https://go.microsoft.com/fwlink/?linkid=838655 --> <location path="." inheritInChildApplications="false"> <system.webServer> <handlers> <!--<remove name="aspNetCore"/>--> <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified"/> </handlers> <aspNetCore processPath="dotnet" arguments=".AspNetCore5Demo.dll" stdoutLogEnabled="false" stdoutLogFile=".logsstdout" hostingModel="inprocess"/> </system.webServer> </location> </configuration>
主意IIS中模块,是否存在,安装dotnet-hosting
添加网站-设置网站文件地址
程序池配置
运行效果