如何在同一URL下托管多个.NET Core应用 [英] How to host multiple .NET Core apps under same url

查看:243
本文介绍了如何在同一URL下托管多个.NET Core应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在asp.net核心中构建一些网站(多个用户界面应用程序和一个Web api应用程序).他们都利用Web API一起工作.就我的问题而言,我们将其称为App1,App2和App3.我将网站托管在IIS中.

I am building a few web sites in asp.net core (multiple user interface applications and a web api app). They all work together, utilising the web api. For the purpose of my question we'll call them App1, App2 and App3. I am hosting my websites in IIS.

通常,在旧的.net Framework(4.5.1)中,我将在IIS中拥有一个网站,其中包含多个Web应用程序来承载我的多个应用程序.像这样:

Typically, in the old .net Framework (4.5.1), I would have one website in IIS, with multiple web apps to host my multiple applications. Like so:

  • WebSite1-在端口443上运行

  • WebSite1 - running on port 443

  • App1

  • App1

App2

App3

如果网站(WebSite1)在端口443上运行(使用SSL证书),则意味着可以通过一个域网址访问所有应用,如下所示:

If the website (WebSite1) runs on port 443 (using the SSL cert), that means all apps are accessible via one domain url as follows:

https://www.myapp.com/App2/

https://www.myapp.com/App3/

在网址末尾使用不同的应用名称来标识它们.

With different app names at the end of the url to identify them.

在托管新的asp.NET Core应用程序时,我也托管在IIS中,并按照asp.NET Core网站部署的文档,将每个.NET Core Web应用程序托管在IIS中的另一个站点中.

When hosting the new asp.NET Core applications, I host in IIS as well, and following the documentation for asp.NET Core web site deployment, I host each .NET Core web app in a different site within IIS.

因为我所有站点都有一个域名,例如 https://www.example.com (我正在使用SSL证书),我必须给其他网站提供不同的端口.所以我最终得到这样的东西:

As I have one domain name for all my sites, for example, https://www.example.com (I'm using an SSL cert), I have to give the other websites different ports. So I end up with something like this:

  • WebSite1-在端口443上运行

  • WebSite1 - running on port 443

WebSite2-在端口444上运行

WebSite2 - running on port 444

WebSite3-在端口445上运行

WebSite3 - running on port 445

然后可以通过以下域名网址访问所有这些应用程序:

All of these apps are then accessible via these domain name urls:

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆