一、前言
最近使用 AbpVnext .NetCore 開發項目,網站啟動後可以通過 http://localhost:44349 或者http:127.0.0.1:4349正常通路;
但是通過本機區域網路IP http://192.168.1.101:44349 卻無法通路,防火牆裡面44349端口入棧規則也配置了;這是因為程式啟動監聽在http://localhost:44349上面,是以無法通路;
二、解決方案
- 打開xxx.web 項目下 Properties/launchSettings.json 檔案
- 添加一個額外配置:http://0.0.0.0:44349;
{
*********************
"AoRuiDe.GasMonitoring.Web": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:44349/;http://0.0.0.0:44349;"
}
}
}
-
特别說明:此方法僅适用于 VS程式設計調試的時候有效; 針對釋出出去的網站程式這個配置是無效的;
釋出出去的程式 如果通過輕按兩下xxxWeb.exe啟動網站接口服務,服務預設監聽在 : http://localhost:5000;https://localhost:5001;兩個位址,通過區域網路位址http://192.168.1.250:5000的方式是通路不了的;
- 釋出出去的程式如何在區域網路通路,詳見下一章節;
三、總結
當當當當…