使.NET6在開發(fā)時支持IIS
操作步驟
1.下載dotnet-hosting-6.0.0-rc.1.21452.15-win.exe并安裝,成功后檢查IIS模塊中是否有AspNetCoreModuleV2
2.安裝VS時選擇“開發(fā)時IIS支持”
3.在IIS中創(chuàng)建站點,目錄指向開發(fā)項目wwwroot的上級目錄,應(yīng)用程序池默認與站點名稱相同
4.將剛新建站點的應(yīng)用程序池的.NET CLR版本改成無托管代碼
5.在項目啟動配置文件中添加配置(也可在項目屬性調(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.在項目中添加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ā)時支持IIS的文章就介紹到這了。希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
asp.net實例代碼protected override void Render(HtmlTextWriter wri
把最終要輸出的html壓縮后再輸出和最終輸出前先存為html文件,如果發(fā)布最新信息了,可以打開一次default.aspx,然后他又會生成一次html2008-08-08ASP.NET Core應(yīng)用啟動Startup類簡介
這篇文章介紹了ASP.NET Core中的應(yīng)用啟動Startup類,文中通過示例代碼介紹的非常詳細。對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2022-04-04