混合ASP.NET VB和C#ASP.MVC项目在一个单一的解决方案 [英] Mixing VB ASP.NET and C# ASP.MVC projects in a single solution

查看:253
本文介绍了混合ASP.NET VB和C#ASP.MVC项目在一个单一的解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景

我们是谁继承遗产ASP.NET应用程序TDD团队,正试图通过分离,使其得到控制演示,业务和数据访问问题和从而提高可测试性。我们不得不使用新添加的页面的MVP模式取得了一些成功,但正在调查MS MVC框架,看看它给我们带来了MVP任何好处。重要的是,我们希望新的MVC的工作是在C#中,而传统的应用是在VB。我们已经看过这个博客条目它主要实现了我们想要的东西,但不允许我们在C#代码。此外,还有一个关于分割在多个项目一个Web应用程序可看上去很有用(的这里

We are a TDD team who have inherited a legacy ASP.NET application and are trying to bring it under control by separating presentation, business and data access concerns and thereby improving testability. We have had some success using an MVP pattern for newly added pages but are investigating the MS MVC framework to see if it gives us any benefit over MVP. Importantly, we would want the new MVC work to be in C# while the legacy application is in VB. We have looked at this blog entry which mostly achieves what we want but doesn't allow us to code in C#. Additionally, there are a number of blog entries about partitioning a single web application across multiple projects which looked useful (here)

问题

能否创建一个包含由两个项目,一个Web应用程序的工作原型(默认VB ASP.NET项目和默认的C#MVC项目),并有他们很好共同努力。我一直没能成功地做到这一点(我认为是由于路由问题)。如果可以,我想看看你的web.config和Global.asax的文件。

Can you create a working prototype consisting of a single web application made up of two projects (the default VB ASP.NET project and the default C# MVC project) and have them work nicely together. I have not been able to do this successfully (I think due to routing issues). If you can I'd like to see your web.config and global.asax files.

推荐答案

默认MVC应用程序包含两个在项目的根代码的重要位,他们将需要在您的应用程序的根目录也存在:

The default MVC app contains two important bits of code in the root of the project, and they will need to exist in the root of your app too:


  1. Global.asax中 - 后面的代码设置了所有的路由

  2. Default.aspx的 - 后面的代码触发了MvcHttpHandler,并开始你走下MVC路线

  1. The Global.asax - the code behind sets up the all the routing.
  2. The Default.aspx - the code behind fires up the MvcHttpHandler, and starts you off down the MVC routes

这两个都需要在你的网站的根(或成立地方以类似的方式),以正确加载和启动妥善处理所有的路由 - 你还应该确保你的路由是不够具体,没有赶上遗留应用程序的页面

Both of these will need to be in the root of your website (or be set up in a similar way somewhere) to load up correctly and start handling all the routing properly - you should also ensure that your routes are specific enough not to catch the legacy apps pages.

这篇关于混合ASP.NET VB和C#ASP.MVC项目在一个单一的解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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