您好,登錄后才能下訂單哦!
怎樣使.NET6在開發(fā)時(shí)支持IIS,相信很多沒有經(jīng)驗(yàn)的人對(duì)此束手無(wú)策,為此本文總結(jié)了問題出現(xiàn)的原因和解決方法,通過這篇文章希望你能解決這個(gè)問題。
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版本改成無(wú)托管代碼
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>
看完上述內(nèi)容,你們掌握怎樣使.NET6在開發(fā)時(shí)支持IIS的方法了嗎?如果還想學(xué)到更多技能或想了解更多相關(guān)內(nèi)容,歡迎關(guān)注億速云行業(yè)資訊頻道,感謝各位的閱讀!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。