ASP.NET MVC - FORMS 根项目中是否可以有 MVC 子项目?

发布于 2024-07-24 05:46:14 字数 751 浏览 5 评论 0原文

我正在尝试了解其他人是否能够做到这一点。 我找到了以下问题和答案(参考 Scott Hanselmans 关于混合表单和 MVC 的帖子)(我可以将 ASP.NET MVC 与常规 ASP.NET Web 表单一起使用)。 然而这并不完全相同。

您是否能够在服务器上运行 .NET FORMS 项目(作为根项目),同时在同一服务器上运行 MVC(作为子项目)? 只需尝试空的默认项目,它不会工作:)

http://server (或 http://www.server.com) --- 表格项目
http://server/mvc (或 http://www.server.com/mvc) --- MVC 项目

I'm trying to find out if other people are able to do this. I've found the following question and answer (which refers to Scott Hanselmans post on mixing Forms and MVC) (Can I use ASP.NET MVC together with regular ASP.NET Web forms). However this is not quite the same.

Are you able to run a .NET FORMS project on a server (as rootproject) and at the same time have a MVC running on the same server (as subproject)? Just try empty default projects, it won't work :)

http://server (or http://www.server.com) --- FORMS PROJECT
http://server/mvc (or http://www.server.com/mvc) --- MVC PROJECT

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

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

发布评论

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

评论(2

浅紫色的梦幻 2024-07-31 05:46:14

当然,只需配置 IIS,使两个文件夹都是应用程序即可。 尽管您可能无法使用 VS 网络服务器。

Sure, just configure IIS so that both folders are applications. Though you will probably not be able to use the VS webserver.

慈悲佛祖 2024-07-31 05:46:14

这意味着您需要将 2(两个)IIS 站点绑定到同一 IP/端口,这会在 IIS 中产生问题。 我认为您应该尝试同时运行一个混合项目,其中一些由 WebForms 处理,另一些由 MVC 处理。 如果需要,您始终可以拆分 MVC 项目,并在另一个项目中拥有数据访问、业务逻辑和控制器。 如果您想查看这样的示例,下面有一个指向 S#arp 架构的链接,它将 MVC 项目分为许多部分。

http://sharparchitecture.net/

That would imply you would want bind 2 (two) IIS sites to the same IP/Port which would create an issue in IIS. I think instead you should try to run a hybrid project with both and have some handled by WebForms and some handled by MVC. You could always just split up the MVC project and have data access, business logic and controllers in another project if you want. If you want to see an example of this there's a link below to the S#arp Architecture which splits an MVC project into many parts.

http://sharparchitecture.net/

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