使.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)用程序池默認(rèn)與站點名稱相同
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?Core開發(fā)環(huán)境安裝配置
這篇文章介紹了ASP.NET?Core開發(fā)環(huán)境安裝配置,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2022-02-02
Entity Framework系統(tǒng)架構(gòu)與原理介紹
這篇文章介紹了Entity Framework系統(tǒng)架構(gòu)與原理,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2022-03-03

