简体   繁体   English

多个asp.net Web应用程序的最佳实践

[英]Best Practice for multiple asp.net web applications

Looking for the best practice when having multiple web applications within one ASP.NET "site" or "solution". 在一个ASP.NET“站点”或“解决方案”中拥有多个Web应用程序时,寻找最佳实践。 I have a few options I am toying with: 我有几个选择:

  1. old faithful of putting all applications and Site master into one Solution / one web application 老忠实地将所有应用程序和Site master放入一个解决方案/一个Web应用程序中

  2. My boss is worried about having 30 'applications' that are all under the same project in VS and every time we make a change to one have to deploy to all. 我的老板担心在VS中有30个“应用程序”都在同一个项目中,每次我们对一个项目进行更改都需要部署到所有项目。 So this makes us want to break out each into a separate project under the same solution. 因此,这使我们希望在同一解决方案下将每个项目分解为单独的项目。 This makes us have to look into Master page solutions 这使得我们必须研究Master页面解决方案

    • Master page needs to support dynamic menu structure. 母版页需要支持动态菜单结构。 Is this something that I can do with a single SiteMaster? 这是我可以用一个SiteMaster做的事吗? Does VirtualProvider provide the right solution for this? VirtualProvider是否为此提供了正确的解决方案? Anyone have any good tutorials on it? 有人有任何好的教程吗?
  3. Creating a UserControl for each application and reference it in the main application 为每个应用程序创建UserControl并在主应用程序中引用它

I asked two similar questions here: 我在这里问了两个类似的问题:

Cross-Project Master Page 跨项目母版页

Best bet is separate projects under a single solution and use Nuget package to synch up the common artifacts, including master pages. 最好的选择是单一解决方案下的单独项目,并使用Nuget包来同步常见工件,包括母版页。 Right now this is working fine on a 22 project solution I'm working on. 现在,这正在我正在研究的22项目解决方案上运行良好。 You can also store the Nuget package itself in source control. 您还可以将Nuget包本身存储在源代码管理中。

Update: 更新:

You could use an XML file for your menu and share it out with Nuget. 您可以将XML文件用于菜单并与Nuget共享。 Possibly add jQuery for a sliding effect, etc. 可能会添加jQuery以获得滑动效果等。

1) So this makes us want to break out each into a separate project under the same solution. 1)因此,这使我们希望在同一解决方案下将每个项目分解为单独的项目。

(Good idea) (好主意)

Master page needs to support dynamic menu structure. 母版页需要支持动态菜单结构。

As a side note, Have you ever heard of MEF ? 作为旁注,你有没有听说过MEF
This is pretty suitable for your case. 这非常适合您的情况。
Using it, you can have a full extensible master page solution with ability to add extra menus (and functionality for each) on the fly!!!. 使用它,您可以拥有一个完整的可扩展母版页解决方案,能够动态添加额外的菜单(以及每个菜单的功能)!
By MEF technology you can have separate project under a single solution. 通过MEF技术,您可以在单一解决方案下拥有单独的项目。 Every (new/updated) project can be 每个(新的/更新的)项目都可以

  • Published / Republished. 出版/再版。
  • have it's content files merged with the main already published site (master project) 将它的内容文件与主要已发布的站点 (主项目)合并
  • Copy generated dll of the child project into bin folder 将生成的子项目的dll复制到bin文件夹中
  • Restart the site. 重启网站。

here are some paper about it: Microsoft reference , CodeProject basics for Asp.Net 这里有一些关于它的论文: 微软参考Asp.Net的CodeProject基础知识
There is also a concept named Portable Area . 还有一个名为Portable Area的概念。 But i don't know about how it works or what exact scenario it covers or even if it is applicable for Asp.Net or only for Asp.Mvc . 但我不知道它是如何工作的或它涵盖的确切场景,或者它是否适用于Asp.Net或仅适用于Asp.Mvc just give it a try if interested. 如果有兴趣,试试吧。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM