IIS 安裝
控制面板 -> 程序 -> 啟動或關閉windows功能 -> Internet Information Service (勾選所有選項)
部署
下載地址:https://dotnet.microsoft.com/download/dotnet/5.0
必須安裝
點擊項目,選擇【發布】
點擊【發布】
腳本啟動
CMD運行腳本
D:\DemoCode\DemoPublic>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=".\logs\stdout" hostingModel="inprocess"/> </system.webServer> </location> </configuration>
主意IIS中模塊,是否存在,安裝dotnet-hosting
添加網站-設置網站文件地址
程序池配置
運行效果