ASP.NET Web 应用程序架构设计建议 [英] ASP.NET web application architecture design advice

查看:21
本文介绍了ASP.NET Web 应用程序架构设计建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以前我的 ASP.NET Web 应用程序使用 ADO.NET 直接连接到数据库.现在我想把它改成3层,ASP.NET层,中间web服务层和后端数据库层.我觉得好处是可以把数据源抽象到ASP.NET前端,松散耦合,降低潜在的安全风险,让外部暴露的ASP.Net web应用可以直接访问数据库等.

previously my ASP.NET web application connects to a database directly using ADO.NET. Now I want to change it to 3 layers, ASP.NET layer, middle web service layer and backend database layer. I think there is benefit that I could abstract data source to ASP.NET front layer, loosely coupled and reduce potential security risks to let external exposed ASP.Net web application to be able to access database directly, etc.

与 2 层架构和 3 层架构相比,我遇到了 2 个主要问题.

Compared with 2 layer architecture with the 3 layer architecture, I met with 2 major issues.

  1. 额外的中间 Web 服务层会产生更多流量,例如ASP.NET 不直接与数据库对话,而是与 Web 服务对话,而 Web 服务与数据库对话,会产生更多流量.会不会成为瓶颈?如果这是瓶颈,有什么一般性建议可以解决这个问题吗?

  1. An additional middle web service layer will incur more traffic, e.g. ASP.NET does not talks to database directly, but talks to a web service and the web service talks to thedatabase, will incur more traffic. Will it be a bottleneck? Any general advice to solve this issue if it is a bottleneck?

由于 ASP.NET 无法连接到数据库但连接到 Web 服务,因此无法轻松获取 DataSet/DataTable 对象.将表格表单数据呈现给数据绑定控件变得很困难.有什么想法可以让 ASP.NET 中的表示层更容易编码吗?

Since ASP.NET can not connect to database but connect to web service, it can not get easily a DataSet/DataTable object. It becomes hard to present table form data to data bound controls. Any ideas to make presentation layer in ASP.NET easier coding?

问候,
乔治

推荐答案

如果你只是认为有好处,你就不应该这样做.您正在谈论增加大量复杂性并为自己工作,以牺牲性能、代码简单性和架构简单性为代价,为了……什么?你得到了什么值得这些成本?

If you only think there is a benefit, you should not do it. You are talking about adding a large amount of complexity and work for yourself, at the cost of performance, code simplicity, and architectural simplicity, for... what? What do you gain that's worth these costs?

你:

  • 有紧急的安全相关需求,需要断开 Web 前端与数据库服务器的连接(不,不是假设的我打赌这会更安全",而是可证明的,具体的安全问题,无法解决通过对您授予 ASP.NET 应用程序的 DB 权限保持明智来解决

  • Have urgent security-related needs that require disconnecting the web front-end from the database server (no, not hypothetical "I bet this would be more secure" but demonstrable, concrete security problems which cannot be solved by being smart about what DB rights you grant your ASP.NET application)

希望在未来的某个时间点(可能会重复)完全换出您的数据层,因此需要将您的网络代码库与彻底的数据库更改隔离?

Expect to swap your data tier out completely at some point in the future (probably repeatedly), and thus need to insulate your web codebase from radical DB changes?

几乎在所有情况下,这些问题的答案是否定的.这样做只会给自己和其他可能接触此应用的人增加痛苦.

The answer to these in very nearly every case is no. Doing this would just be adding pain for yourself and anyone else who might touch this app.

这篇关于ASP.NET Web 应用程序架构设计建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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