WinForms 远程数据访问

发布于 2024-09-18 08:43:31 字数 124 浏览 2 评论 0原文

VS2010:从 WinForms 应用程序通过 Internet 访问远程数据库的最佳方式是什么?我的意思并不是直接与数据库(SQL Server)对话,而是通过服务。如果我可以使用 http 作为协议来避免防火墙问题,那就最好了。

VS2010: What is the best way to access a remote database over the internet from a WinForms application? By that I don't mean talking to the database (SQL Server) directly, but rather through a service. Best if I could use http as a protocol to avoid firewall issues.

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

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

发布评论

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

评论(2

回首观望 2024-09-25 08:43:32

建议您查看 WCF

如果您可以控制两端, 然后,您可以通过配置更改协议等,但是,http:80 通常是遵守防火墙策略的最简单方法。

Would recommend that you look at WCF

If you have control over both ends of the connection, you then can change protocol etc through configuration, but yes, http:80 is usually the easiest way to adhere to firewall policies.

一花一树开 2024-09-25 08:43:32

如果您希望保持简单并且您的需求有限,您始终可以使用通过 WCF(或 .Net Remoting)传递的类型化数据集。但是,如果您的应用程序变得更加复杂或者您有大量数据,您很快就会遇到问题。

SqlServer 将通过soap 公开存储过程,如果您的应用程序使用一些不太频繁的存储过程,这可能会很有效。

如果您想要简单的 CRAD 操作,可以选择使用 WCF 数据服务公开数据。
否则,您将必须在 WCF 接口上定义所需的所有方法。

如果您不依赖 WinForm,请查看带有 Silverlight 的 WCF RIA 服务,因为这将为您完成大多数 CRAD 类型应用程序的大量艰苦工作。但您需要学习 Silverlight。

问题是没有简单且有效的方法
简单的解决方案“呈现
互联网不妨碍”并且移动
到 3 层应用程序将始终
让你的代码更复杂。 A 3 层
建筑可以发挥更多作用
复杂且要求苛刻的应用,
但往往杀戮过度。

还可以考虑编写一个 2 层 WinForms 应用程序并使用终端服务通过 Internet 将其公开给您的客户端。这通常是最便宜的解决方案,并且往往给系统管理员带来最少的痛苦。 但是,由于某种原因,很多程序员认为这是“作弊”。

If you wish to keep this simple and your needs are limited you could always use a typed dataset that you pass over WCF (or .Net Remoting). However you will quickly hit problems if your app gets more complex or you have lots of data.

SqlServer will exposed stored procs over soap, this may work well if your applications uses a few stored procs that are not too chatty.

Exposing your data with WCF Data Services is an option if you want simple CRAD operations.
Otherwise you will have to define all the methods you need on WCF interfaces.

If you are not tied to WinForm, look at WCF RIA Services with Silverlight as this will do a lot of the hard work for you with most CRAD type applications. But you will need to learn Silverlight.

The problem is there is no simple and
easy solution to “presenting the
internet is not in the way” and moving
to a 3 tier application will always
make your code more complex. A 3 tier
architecture can be great for more
complex and demanding applications,
but is often over kill.

Also consider writing a 2 tier WinForms application and using Terminal Services to expose it to your clients over the internet. This is often the cheapest solution and tends to give the least pain with system admin. However a lot of programmers think it is “cheating” for some reason.

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