Can't connect on localhost, can from network
Can't connect on localhost, can from network
Hey everyone, I built a windows application in visual studio 2005 that connects to mysql just fine from desktop machines on the network.
Now I would like to move the application to the server's shared directory so that I don't have to install it on each user's machine individually.
So I changed the 'host' parameter in application's connection string from our server name to 'localhost', compiled, and plopped the files into the shared folder making sure to include CoreLab.MySql.dll.
The application runs until I need to use mysqldirect at which point I get "Can't connect to MySQL server on 'localhost'(10061)" Yet I have no problems executing my application from desktop machines.
I have not installed the .NET framework on the server and I'd rather not if I don't have to. I assume this is not a problem since the app runs until it's time to connect to mysql? But if that is so, why can't I connect from the server?
I'm new to MySQL, .NET, I know little about our Windows Server (2003) and I couldn't find any posts that addressed this.
Now I would like to move the application to the server's shared directory so that I don't have to install it on each user's machine individually.
So I changed the 'host' parameter in application's connection string from our server name to 'localhost', compiled, and plopped the files into the shared folder making sure to include CoreLab.MySql.dll.
The application runs until I need to use mysqldirect at which point I get "Can't connect to MySQL server on 'localhost'(10061)" Yet I have no problems executing my application from desktop machines.
I have not installed the .NET framework on the server and I'd rather not if I don't have to. I assume this is not a problem since the app runs until it's time to connect to mysql? But if that is so, why can't I connect from the server?
I'm new to MySQL, .NET, I know little about our Windows Server (2003) and I couldn't find any posts that addressed this.
I'm confident the host name is correct because it works when my application is on a desktop machine. It is also apparent to me from the speed at which my connection is rejected that the host name is correct.
I've used the server machine name, 'localhost', and the IP address as the host paramenter, all to no avail
I appreciate the response, can you think of anything else that might be causing this error?
I've used the server machine name, 'localhost', and the IP address as the host paramenter, all to no avail
I appreciate the response, can you think of anything else that might be causing this error?
I have tried putting the application in our server's designated shared folder as well as C: and D: root directories. I've ensured that these directories grant full permissions to users that access them and have no trouble actually opening the program from these directories. It is only when I attempt to connect to mysql that I get the exception.
-
- Posts: 38
- Joined: Tue 07 Mar 2006 17:13
Deployment strategies
This is a shot in the dark, but I think the problem you are experiencing is that you don't have the MySQL components installed in the GAC on the machines you are trying to run it on (when it fails). You say you have tried it on desktop machines, but my bet is that the desktop machines in question are devel machines and already have the MySQL component installed on them.
If you then attempt to run the application from a machine that doesn't have the devel tools on it, it ought to fail since the components aren't in the GAC.
A better deployment strategy would be to publish the application to the server, and then have users run the installed setup program which will put the required components in the GAC. If you go this route, make sure to override the "Auto" setting for the MySQL components and instead select the "Include" option which will force the publish package to install the components into the user's desktop GAC.
If you then attempt to run the application from a machine that doesn't have the devel tools on it, it ought to fail since the components aren't in the GAC.
A better deployment strategy would be to publish the application to the server, and then have users run the installed setup program which will put the required components in the GAC. If you go this route, make sure to override the "Auto" setting for the MySQL components and instead select the "Include" option which will force the publish package to install the components into the user's desktop GAC.
Thanks, John, for your suggestion, but i think the problem crops up due to the fact that the application is run from a desktop machine with "localhost" parameter in connection string. That's why it cannot connect to a database, because it looks for the database on the localhost instead of the server.
John: I'm not sure which development tools I might be missing on the server. I copied the mysqldirect dll into my application's directory. Maybe I need to install mysqldirect on the server? I'm open to try anything, I'm out of ideas.
Alexey: I created a test application that will adjust the host parameter of my connection string on the fly. I've tried every concievable parameter (machine name, ip address, localhost) and can't get it to connect when my app resides on the server.
I'm fairly certain that I set the app directory on the server to allow full access but I am a noob at server stuff and I'd feel silly if this turned out to be a server issue. I'm about to give up on this, if only temporarily.
Alexey: I created a test application that will adjust the host parameter of my connection string on the fly. I've tried every concievable parameter (machine name, ip address, localhost) and can't get it to connect when my app resides on the server.
I'm fairly certain that I set the app directory on the server to allow full access but I am a noob at server stuff and I'd feel silly if this turned out to be a server issue. I'm about to give up on this, if only temporarily.
OK, usually we do not give advices about configuring client or server because this exceeds goals of our support. But in this case we made an exclusion and scrutinized the problem.
You should do the following (relates to Windows XP):
1. On each desktop PC choose Start --> Control Panel --> Administrative Tools.
2. Run Microsoft .NET Framework Configuration.
3. Go to Console Root --> Microsoft .NET Framework Configuration --> My Computer --> Runtime Security Policy.
4. Click on "Adjust Zone Security".
5. Set "Full Trust" level for Local Intranet.
You are done.
You should do the following (relates to Windows XP):
1. On each desktop PC choose Start --> Control Panel --> Administrative Tools.
2. Run Microsoft .NET Framework Configuration.
3. Go to Console Root --> Microsoft .NET Framework Configuration --> My Computer --> Runtime Security Policy.
4. Click on "Adjust Zone Security".
5. Set "Full Trust" level for Local Intranet.
You are done.