使用C#和.NET连接到MySQL数据库. [英] Connecting to MySQL Database using C# and .NET.
问题描述
你好朋友,
我正在创建一个 WEB服务,我必须将其上传到具有MySQL作为Web数据库的Linux服务器上. WEB服务在 WINDOW服务中用作参考.
根据codeproject.com( ^ ]).要安装.Net库,以便在中使用MySQL数据库.网.但是由于 WEB SERVICE 将位于LINUX服务器上;为了使与MySQL db的 WEB SERVICE 连接正常工作,是否还必须在Linux服务器上安装此.Net库?
谢谢
Hello friends,
I am creating a WEB SERVICE which i have to upload on a Linux server having MySQL as database on the web. The WEB SERVICE is used as as a reference in a WINDOW SERVICE.
I need to make a connection to MySQL db on the WEB SERVICE in order to fetch data from MySQL and according to an article on codeproject.com (Connecting to MySQL Database using C# and .NET[^]) a .Net library is to be installed in order to use the MySQL db in .Net. But as this WEB SERVICE will be located at the LINUX server; do i have to install this .Net library at Linux server also in order to make the WEB SERVICE connection to MySQL db work?
Thanks
推荐答案
我认为您是在Linux服务器上运行 Mono ...并托管.Net Web服务?
如果是这种情况,则是-由于Web服务将创建数据连接,因此它将要求MySQL.Net connextor程序集在Linux机器上可用.
或者,您可以使用PHP或其他任何方式创建非.Net Web服务,然后在Linux机器上运行该服务.只是让您的.Net Windows服务使用该Web服务.
I take it you''re running Mono on the Linux server....and hosting a .Net web service?
If this is the case then yes - since the web service will be creating the data connection, it will require the MySQL.Net connextor assembly to be available on the Linux machine
Alternatively, you could create a non .Net web service in PHP or whatever and run that on the Linux machine & just have your .Net windows service consume the web service.
可能尝试使用IP地址并在连接字符串中指定端口.... e.g
Possibly try using IP address and specifying port in your connection string....e.g
Server=192.168.1.1;Port=1234;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
这篇关于使用C#和.NET连接到MySQL数据库.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!