IIS中的MVC3结构

发布于 2024-11-05 18:35:00 字数 695 浏览 0 评论 0原文

我正在制作几个网络应用程序。我在这里想要做的是:

  1. 应用程序应该使用不同的应用程序池在 IIS 中独立。

  2. 有一个主要应用程序单独用作首页,允许登录/退出并将用户导航到其他应用程序。

  3. 我希望其他应用程序使用主应用程序的布局。

我想到的结构是将主应用程序部署在网站的根文件夹下,并将其他应用程序托管在单独的文件夹中(单独的应用程序和池)。类似的东西:

IIS
  |
  |__Main app (web site)
        |
        |__App1
        |
        |__App2

但是,我在这里感到困惑:

  1. 如何在应用程序/池中重用布局/dll,而不将它们复制到每个应用程序中(也许这是一个愚蠢的问题)

  2. 如何使用 MVC3 控制器/操作功能而不是直接使用硬编码 将用户导航到每个应用程序。我实际上尝试过。看起来主应用程序 (MVC3) 只能识别其自己项目中的控制器和视图。

总之,我尝试做的是:在上面的树结构中部署我的应用程序,让主应用程序从子应用程序中引入视图并显示在主应用程序的框架中。

也许这不是一个好的做法,但欢迎任何建议!

多谢

I am making several web applications. What I want to do here is:

  1. Applications should stand alone in IIS using differnt application pool.

  2. There is one main application used solo as front page, allowing log in/out and navigate users to other applications.

  3. I want other applications to use the layout of the main application.

The structure I was thinking was to deploy the main application under root folder of the website and host other applications under it in seperate folder (seperate application and pool). Something like:

IIS
  |
  |__Main app (web site)
        |
        |__App1
        |
        |__App2

However, I just got confused here:

  1. How can I reuse the layout/dll acorss apps/pools without copying them into each application (Maybe it's a silly question)

  2. How can I use MVC3 controller/action feature instead of directly using hard coded <a/> to navigate users to each application. I actually tried it. Looks like the Main app (MVC3) can only recognize controller and view in it's own project.

In summary, what I try to do is: Deploying my applications in the tree sturcture above and let the main app bring views from sub apps and display in main app's frame.

Maybe it's not a good practise, but any suggetion is welcomed!!!

Thanks a lot

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

等风来 2024-11-12 18:35:00

听起来您确实想在 MVC 中使用 Areas。这不允许您在自己的应用程序池中运行嵌套的“应用程序”,但它可以完成您想要做的所有其他事情(共享布局、dll、Html.ActionLink、基于角色的访问)到每个区域等)。您可以轻松地在所有区域共享顶级导航,并为每个区域提供不同的子导航。我有一篇关于使用跨区域共享的单一布局的两部分博客文章,可能会给您一些帮助(或想法)。

具有 ASPX 和 Razor 视图的区域的单一布局(部分1) - 使用 ASPX 视图引擎

具有 ASPX 和 Razor 视图的区域的单一布局(第 2 部分) - 使用 Razor View Engine

如果您觉得在单个项目的区域中拥有子应用程序过于严格,您也可以考虑使用MvcContrib 使您的子应用程序位于可移植区域中然后在您的顶级应用程序中使用它们。

It really sounds like you would want to make use of Areas in MVC. This wouldn't allow you to run the nested "applications" in their own App Pool, but it would accomplish everything else you are looking to do (shared layouts, dlls, Html.ActionLink, roles based access to each Area, etc). You can easily share top level navigation across all Areas and have different sub navigation for each. I have a 2 part blog post about using a single layout that is shared across Areas that might give you some help (or ideas).

Single Layout for Areas with ASPX and Razor views (Part 1) - Using the ASPX View Engine

Single Layout for Areas with ASPX and Razor views (Part 2) - Using the Razor View Engine

If you felt that having sub apps in Areas in a single project was too rigid you could also look into using MvcContrib to make your sub apps in Portable Areas and then consume them in your top level app.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文