且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用C#和.NET连接到MySQL数据库.

更新时间:2022-11-29 21:41:12

我认为您是在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;