ASP.Net MVC应用程序URL架构

时间:2021-08-26 06:55:24

I have inherited an existing ASP.Net MVC C# web application solution.

我继承了现有的ASP.Net MVC C#Web应用程序解决方案。

Currently, there are two separate Web Application projects.

目前,有两个单独的Web应用程序项目。

  1. An Admin site - used to managed the content of the public facing site.
  2. 管理员站点 - 用于管理面向公众的站点的内容。

  3. The public facing site
  4. 面向公众的网站

Currently, the public facing site is not in production; only the Admin site is deployed on Windows Server 2012 running IIS 8.0 using the client's domain e.g. www.mysite.com

目前,面向公众的网站尚未投入生产;只有Admin站点部署在使用客户端域运行IIS 8.0的Windows Server 2012上,例如www.mysite.com

The client would like the public facing site and the admin site to be accessibile via the same domain:

客户希望面向公众的站点和管理站点可以通过同一个域进行访问:

Public: www.mysite.com
Admin: www.mysite.com/admin or admin.mysite.com

公众:www.mysite.com管理员:www.mysite.com/admin或admin.mysite.com

Is there any way to achieve this given the two sets of functionality are currently encapsulated in different Web Applications?

有没有办法实现这一点,因为目前这两套功能都封装在不同的Web应用程序中?

I'm wondering if:

我想知道是否:

  1. Is there a way to achieve the above with sub-domains or some other feature of IIS
  2. 有没有办法通过子域或IIS的其他一些功能实现上述目的

  3. Or if its best to move all the Admin functionality into an MVC Area within a single Web Application
  4. 或者,如果最好将所有Admin功能移动到单个Web应用程序中的MVC区域中

Discussions on the pros/cons of each approach (or links to resources) would be most appreciated.

关于每种方法(或资源链接)的利弊的讨论将是最受欢迎的。

1 个解决方案

#1


0  

I would rather move admin site and public facing site in single web app in separate area as OP said.

OP表示,我宁愿在单独的网络应用中移动管理站点和面向公众的站点。

You can use host-header facility in IIS to adjust root domain url to admin.mysite.com (or such).

您可以在IIS中使用主机标头工具将根域URL调整为admin.mysite.com(或其他)。

advantage of such approach is maintenance will be easier as code base is part of single vsnet solution, Assuming public facing site will have lot more content/controller/views and admin site will have less of those, there is no point in maintaining separate .SLN for admin.

这种方法的优点是维护将更容易,因为代码库是单个vsnet解决方案的一部分,假设面向公众的站点将拥有更多的内容/控制器/视图,而管理站点将具有更少的那些,没有必要维护单独的.SLN为管理员。

#1


0  

I would rather move admin site and public facing site in single web app in separate area as OP said.

OP表示,我宁愿在单独的网络应用中移动管理站点和面向公众的站点。

You can use host-header facility in IIS to adjust root domain url to admin.mysite.com (or such).

您可以在IIS中使用主机标头工具将根域URL调整为admin.mysite.com(或其他)。

advantage of such approach is maintenance will be easier as code base is part of single vsnet solution, Assuming public facing site will have lot more content/controller/views and admin site will have less of those, there is no point in maintaining separate .SLN for admin.

这种方法的优点是维护将更容易,因为代码库是单个vsnet解决方案的一部分,假设面向公众的站点将拥有更多的内容/控制器/视图,而管理站点将具有更少的那些,没有必要维护单独的.SLN为管理员。