简体   繁体   English

Windows编程服务无法连接Mysql数据库

[英]Windows programming service is unable to connect to Mysql database

I am using a windows programming in c#,the windows service which I am using as to connect mysql database to fetch the data and it has to upload the data to server.But when the services is being started in my local system, the windows service is getting started first and then Mysql database service is getting started.我在 c# 中使用 windows 编程,我使用 windows 服务连接 mysql 数据库以获取数据,它必须将数据上传到服务器。但是当服务在我的本地系统中启动时,windows 服务是先开始,然后是Mysql 数据库服务开始。 In this case, it is unable to connect to mysql database, so that I have to create a dependency that mysql should start first and then windows service has to start next.在这种情况下,它无法连接到 mysql 数据库,因此我必须创建一个依赖项,该依赖项应先启动 mysql,然后再启动 Windows 服务。

How to implement the dependency code in my program,such that the clients who are using this windows service should not effect with this problem,I have do it through code that it has to be done automatically.如何在我的程序中实现依赖代码,使得使用这个windows服务的客户端不会影响这个问题,我已经通过代码来实现它必须自动完成。

您可以在安装程序类中为 System.ServiceProcess.ServiceInstaller 设置 DelayedAutoStart = true。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM