使.NET6在開發(fā)時(shí)支持IIS
操作步驟
1.下載dotnet-hosting-6.0.0-rc.1.21452.15-win.exe并安裝,成功后檢查IIS模塊中是否有AspNetCoreModuleV2
2.安裝VS時(shí)選擇“開發(fā)時(shí)IIS支持”
3.在IIS中創(chuàng)建站點(diǎn),目錄指向開發(fā)項(xiàng)目wwwroot的上級(jí)目錄,應(yīng)用程序池默認(rèn)與站點(diǎn)名稱相同
4.將剛新建站點(diǎn)的應(yīng)用程序池的.NET CLR版本改成無托管代碼
5.在項(xiàng)目啟動(dòng)配置文件中添加配置(也可在項(xiàng)目屬性調(diào)試中配置)
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iis": {
"applicationUrl": "http://xxx.xxxx.com",
"sslPort": 0
}
},
"profiles": {
"IIS": {
"commandName": "IIS",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
6.在項(xiàng)目中添加web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="bin\Debug\net6.0\Web.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" arguments="">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
</aspNetCore>
</system.webServer>
</location>
</configuration>
到此這篇關(guān)于使.NET6在開發(fā)時(shí)支持IIS的文章就介紹到這了。希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
asp.net實(shí)例代碼protected override void Render(HtmlTextWriter wri
把最終要輸出的html壓縮后再輸出和最終輸出前先存為html文件,如果發(fā)布最新信息了,可以打開一次default.aspx,然后他又會(huì)生成一次html2008-08-08
ASP.NET Core應(yīng)用啟動(dòng)Startup類簡(jiǎn)介
這篇文章介紹了ASP.NET Core中的應(yīng)用啟動(dòng)Startup類,文中通過示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2022-04-04

