ASP.NET 核心在单个应用程序中使用多个 url
ASP.NET Core using multiple urls in single application
我正在创建新的 ASP.NET 核心应用程序,它 运行 在 https://localhost:44382/
上。我想设置多个 url 来浏览我的应用程序,例如 site1.testing.com, site2.testing.com, site3.tseting.com
。
每次浏览这些网址时,我都想重定向到我的应用程序。
我在 launchSetting.json
中找到了这个设置
"myCoreApp": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
如你所见
"applicationUrl": "https://localhost:5001;http://localhost:5000",
通过引用 this ,我尝试更改此设置但不起作用。
您不能为 HTTP 声明超过 1 个 URL,为 HTTPS 协议声明 1 个 URL。 (不包括情况:您使用不同的环境参数)。
为您推荐(也是最佳实践):
- 使用 NGINX 服务器块,或者
- Apache HTTP Server 虚拟主机。
参考:
我正在创建新的 ASP.NET 核心应用程序,它 运行 在 https://localhost:44382/
上。我想设置多个 url 来浏览我的应用程序,例如 site1.testing.com, site2.testing.com, site3.tseting.com
。
每次浏览这些网址时,我都想重定向到我的应用程序。
我在 launchSetting.json
"myCoreApp": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
如你所见
"applicationUrl": "https://localhost:5001;http://localhost:5000",
通过引用 this ,我尝试更改此设置但不起作用。
您不能为 HTTP 声明超过 1 个 URL,为 HTTPS 协议声明 1 个 URL。 (不包括情况:您使用不同的环境参数)。
为您推荐(也是最佳实践):
- 使用 NGINX 服务器块,或者
- Apache HTTP Server 虚拟主机。
参考: