是ASP。NET MVC對於大型企業項目來說不是一個好的選擇?

[英]Is ASP.NET MVC a bad choice for a large enterprise project?

We are about to embark on a large enterprise application. I am seriously considering using ASP.NET MVC because:

我們即將開始一個大型企業應用程序。我正在認真考慮使用ASP。NET MVC,因為:

  1. We need to use Microsoft technology (biz logic is all C#)
  2. 我們需要使用Microsoft技術(biz logic全是c#)
  3. Performance is critical
  4. 性能是至關重要的
  5. I'd like to test as much as possible
  6. 我想要盡可能多的測試

My team has only used PHP for web development, but are very experienced with .NET winforms (so either way we have a learning curve). My concern is that some people have expressed concerns about ASP.NET MVC's scalability to large apps. But from what I read webforms have their own problems as well.

我的團隊只使用PHP進行web開發,但是對於. net winforms(無論哪種方式,我們都有學習曲線)很有經驗。我擔心的是有些人已經表達了對ASP的關注。NET MVC對於大型應用程序的可擴展性。但從我所讀到的內容來看,webforms也有自己的問題。

Should I be reconsidering webforms, or stick with my gut and use ASP.NET MVC?




Should I build my next web app in ASP.NET MVC? https://stackoverflow.com/questions/521388/from-webforms-to-asp-net-mvc


11 个解决方案



ASP.NET WebForms is very much like Winforms and allows for RAD (rapid application development). It's very fast to get something in no-time. Problem with this is testing can be a major pain and if used for anything public facing can mean some major issues with ViewState. WebForms can hold state making things like a wizard a breeze to use.

ASP。NET WebForms與Winforms非常相似,允許使用RAD(快速應用程序開發)。在沒有時間的情況下得到東西是非常快的。問題是測試可能是一個主要的痛苦,如果用於任何公共場合可能意味着一些主要問題的ViewState。WebForms可以保存狀態,可以像向導一樣輕松使用。

ASP.NET MVC on the other hand can take a little longer to develop with and requires that devs understand how HTTP works. It's a stateless architecture meaning each request is it's own little world and usually has no knowledge of previous requests. The framework also allows for high testability.

ASP。另一方面,NET MVC需要更長的時間來開發,並且需要devs了解HTTP是如何工作的。它是一個無狀態的體系結構,意味着每個請求都是它自己的小世界,通常不知道以前的請求。該框架還允許高可測試性。

As far as performance goes they're probably the same because ASP.NET MVC is just a framework built on top of the existing ASP.NET architecture. Though for client-side experience I'd say MVC is a bit faster.

就性能而言,它們可能是相同的,因為ASP。NET MVC只是構建在現有ASP之上的框架。網絡體系結構。但是對於客戶端體驗,我認為MVC更快一點。

As far as scalability I would say they're about the same as far as technical goes. How as for using the API and integrating it MVC would probably be a bit easier.

就可擴展性而言,就技術而言,它們幾乎是一樣的。至於如何使用API和集成it MVC,可能要簡單一些。

The website you're using right now to ask this version question is built on ASP.NET MVC and they have 2 web servers and a beefy db server.




ASP.NET webforms are heavyweight and drop a crapton of stuff on your webpages, both in html/javascript and serialized viewstate. I remember my first ASP.NET website causing the GC to blowed up because of all the short-lived objects being rehydrated from that godawful viewstate. Oh, when I was young and naive (i.e., 2 years ago)... You have to have a very good understanding of webforms to build scalable websites from them. Possible? Definitely. Easy? Not.

ASP。NET webforms是重量級的,它會在你的網頁上放上一堆東西,包括html/javascript和序列化的viewstate。我記得我的第一個ASP。NET網站導致GC膨脹,因為所有短命的對象都被從那個糟糕的視圖狀態中重新水化。哦,當我年輕天真的時候。,2年前)……你必須很好地理解web表單,才能從它們構建可伸縮的網站。可能嗎?肯定。容易嗎?不是。

ASP.NET MVC is harder to code initially, but is SO much easier to develop than webforms. The hardest things to learn are 1) the conventions aka "magic strings", 2) Html + inline code aka ASP and 3) html forms.

ASP。NET MVC最初很難編寫代碼,但是它比webforms更容易開發。最難學的東西是1)慣例,即“魔法字符串”,2)Html +內聯代碼,即ASP和3)Html表單。

With MVC, you can't get away with the state nightmare that is so common to webforms development, which means that means your webpages are meth-addict slim. It also means you have to code your state a little smarter. The code is also MUCH simpler and scales MUCH better than traditional webforms, imho.

使用MVC,您無法擺脫web表單開發中常見的狀態噩夢,這意味着您的web頁面很瘦。這也意味着你必須讓你的狀態更聰明一些。代碼也簡單得多,比傳統的webforms imho的可擴展性好得多。

Also, testing with ASP.NET is near impossible, due to the hard-coded and unmockable dependencies baked into the framework. ASP.NET MVC replaced all of these with System.Web.Abstractions members that are mockable wrappers around these badly-designed and untestable objects.

同時,測試與ASP。NET幾乎是不可能的,因為框架中包含了硬編碼和不可解的依賴項。ASP。NET MVC用System.Web取代了所有這些。抽象成員是這些設計和不可測試對象的可模仿包裝。

Run, don't walk, to MVC.


For the obvious-impared, if you use a framework that sits ontop of the ASP.NET framework, such as MVC or any other that you wrote or that somebody else wrote, OBVIOUSLY some of these remarks don't apply.


If, on the other hand, you code as early man did against the ASP.NET webforms model (e.g., Response.Write() in Page_Load), my comments apply.

另一方面,如果您像早期的人那樣對ASP進行編碼。NET webforms模型(例如,Response.Write() in Page_Load),我的評論也適用。

Can you write code that's testable against ASP.NET? Sure. Can you do it without including special testing code you or somebody else wrote? Sure. If you have TypeMock.




ASP.NET MVC is not a problem for Enterprise, but neither is ASP.NET, Silverlight, etc. They are all UI technologies. The majority of your application logic should exist in libraries beneath the UI layer anyway, so pretty much any UI can be used.

ASP。NET MVC對企業來說不是問題,ASP也不是問題。NET、Silverlight等都是UI技術。無論如何,大多數應用程序邏輯都應該存在於UI層下面的庫中,因此幾乎可以使用任何UI。

  1. We need to use Microsoft technology
  2. 我們需要使用微軟的技術
  3. Performance is critical
  4. 性能是至關重要的
  5. I'd like to test as much as possible
  6. 我想要盡可能多的測試

Based on the above, ASP.NET MVC will work. But, you can move the code down below the UI and test. If your algorithms are below the UI, you can tune them without altering the UI. And, if the UI layer is very thin, the perf hit for the UI is negligible.




No. One thing that the ASP.NET MVC has over ASP.NET Web Forms in terms of performance is that it doesn't make use of a control tree. The control tree consumes a lot of server side memory and keeps the garbage collector very busy on pages with many controls. I would argue that you would get superior performance from the ASP.NET MVC. The unit testing aspects of it are a real win to.

不。有一件事就是ASP。NET MVC已經超越了ASP。就性能而言,NET Web表單不使用控制樹。控制樹消耗大量的服務器端內存,並使垃圾收集器在具有許多控件的頁面上非常繁忙。我認為你會從ASP中獲得更好的性能。凈MVC。單元測試是真正的勝利。

The flip side of this is that you can't use all of the handy out of the box controls that you get with ASP.NET Web Forms and you'll probably end up doing more client side JavaScript development so the initial development budget would probably need to be greater if you choose ASP.NET MVC over Web Forms, but you would have a superior solution for the long term.

它的缺點是你不能使用所有的現成的框式控件。NET Web表單,您可能最終會做更多的客戶端JavaScript開發,因此如果您選擇ASP,那么最初的開發預算可能需要更大。NET MVC勝過Web表單,但是從長遠來看,您將擁有一個更好的解決方案。



Stick with your gut. ASP.NET MVC helps facilitate testing because almost the entire API derives from interfaces.

堅持自己的直覺。ASP。NET MVC有助於促進測試,因為幾乎所有的API都來自接口。



Have used WebForms for years and never liked them. Now use Asp.Net MVC for some years and this is so much better. Certainly woud recommend MVC.

多年來一直使用網絡表單,從未喜歡過它們。現在使用Asp。Net MVC好幾年了,這就好多了。當然—推薦MVC。

Asp.Net MVC has an excellent architecture and is open source. So if you would identify bottelnecks in the http processing chain you could fix it. Most time you would be able to fix performance issues using one of the many extension points provided by Asp.Net MVC, like Binders as an example.

Asp。Net MVC具有優秀的體系結構,並且是開源的。因此,如果您要識別http處理鏈中的bottelneck,您可以修復它。大多數時候,您可以使用Asp提供的許多擴展點之一來修復性能問題。Net MVC,比如綁定器。



I would say go with MVC if you need or want its features . If you are building a line-of-business application such as an ERP or CRM system, I would use Webforms; if you are building a portal or community wiki type site I would go with MVC hands down. Ultimately it comes down to preference and what exactly your enterprise application needs to accomplish.




"With MVC, you can't get away with the state nightmare that is so common to webforms development, which means that means your webpages are meth-addict slim"


Upmodded for that quote!




My opinion: use ASP.NET Webforms.


Disable ViewState in the Web.Config.


There is no need to preserve state because everything you really need is in the Request object. Use Javascript in conjunction with AJAX for data retrieval to render your UI controls client-side.


Create serverside wrappers in the form of control tags for your client-side component renderer. This is how I've been working for ages now, and it's fast, reliable, testable and organized.


It does take some time to setup a decent framework for this working method, but eventually it will rule.


I rather have no spaghetti code like MVC. Been there with PERL/PHP and classic ASP.




Everything I've read about asp.net MVC says that it is able to serve up more page requests than asp.net webforms.

我讀過的關於asp.net MVC的所有信息都表明它比asp.net webforms能提供更多的頁面請求。

I have some doubts about its stability and security though. Both of these stem from the fact that it's not even released and even with the RC we saw some changes to the framework. I am sure there will be more changes as time goes on and things are found. It's new so there are not really "best practices" out for it and there is a not a wealth of experience out there detailing the small issues or gotchas that you might run into.


I've been using it and it does result in smaller pages and faster performance. But there are so many things I can do in webforms that I have no idea how to do with mvc because mvc does not promote the use of the webforms controls.




If you're able to use stored procedures then you don't need a big middle-tier like those generated by MVC. All you have to do is pass XML to your stored procs through a simple HTTP handler, get results back from a stored proc, and convert the results to JSON. MVC and other middle-tier stuff only serves to make money for companies that sell IDEs like VS.




粤ICP备14056181号  © 2014-2020 ITdaan.com