访问远程数据库 - 最佳实践 [英] Accessing a remote database -- best practices

查看:118
本文介绍了访问远程数据库 - 最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个与我的外部Linux服务器通信的C#.NET WPF应用程序。我的服务器上运行的MySQL数据库。

I want to create a C# .NET WPF application which communicates with my external Linux server. On my server runs a MySQL database.

什么是没有通过ADO.NET直接访问它来访问数据库(选择,DML)的最好方法?

What is the best way to access the database (select, DML) without accessing it directly via ADO.NET?

我曾想过一个Web服务,但我不知道如何创建和在Linux服务器上访问与C#web服务。此外,我需要一个安全连接(HTTPS)。

I have thought of a webservice, but I don't know how to create and access a webservice with C# on a linux server. Also I need a secure connection (https).

我希望你能告诉我的最佳做法。

I hope you can tell me best practices.

推荐答案

Web服务是解耦您的应用程序的客户端和服务器部分,访问数据库等提供增强的安全性的好方法。

A web service is a good way to decouple the client and server portions of your app, provide enhanced security for accessing the database, etc.

您正在使用Linux服务器上的MySQL,所以如果你想使用你的服务器的Web服务,.NET,以及,你需要使用单声道的 http://www.mono-project.com/ 。此外,看一看WCF,因为这提供了很多你需要建立在Web服务的功能。如果我没有记错,甚至还有一种方法来自动生成从现有的ADO.NET数据层的一个完整的Web服务。

You're using MySQL on a Linux server, so if you wanted to use .NET for your server's web service as well, you'll need to use Mono http://www.mono-project.com/. Also, take a look at WCF, as this provides a lot of the web service functionality you'll need to build on. If I remember correctly, there's even a way to automatically generate an entire web service from your existing ADO.NET data layer.

然而,如果你是舒适的使用不同的框架在服务器端/语言,有很多的选择了,如果你不希望推出自己的。搜索平安MySQL的,你会得到一些线索,例如:

If however you're comfortable using a different framework / language on the server side, there are plenty of options out there if you don't want to roll your own. Search for "restful mysql" and you'll get some leads, e.g.:

使用REST

http://phprestsql.sourceforge.net/

http://restsql.org

安全性将是非常重要的这里当然。 HTTPS将加密您的通信,但你也需要实现固体认证。

Security is going to be very important here of course. HTTPS will encrypt your communications, but you'll also need to implement solid authentication.

这篇关于访问远程数据库 - 最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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