G F
asked on
Moving new C# program from test to production cannot connect/find any MySQL hosts when running on local network, but connects fine from non domain systems outside the Domain through VPN
Hi!
I wrote a Database program using c# and MariaDB. That is working great on my development system, Windows 10 Pro with LocalHost Database.
When it came time to move the program into production (Server 2016 Server with Domain Controller) I changed the source to the Server's internal IP but I get the following fatal error;
Unable to connect to any of the specified MySQL hosts
However, with some testing I noticed the program works great, when I VPN in using a system not connected to the Domain. Very odd.
Here is the MySQL statement (one combination of many throughout):
MySqlConnection con = new MySqlConnection("server=19 2.168.12.9 ;port=3306 ;database= bbb;uid=ro ot;pwd=;") ;
So, with the client user logged in, and the program on the desktop, I did some trouble shooting:
1) Configured incoming and outgoing TCP and UDP ports of 3306, and eventually disabled the whole Windows Firewall
2) Disabled and eventually removed Kaspersky AV Business
3) Moved the code to another Server, the Domain Controller, and did the same test and had the same result
4) I've installed MySQL and MariaDB ODBC adapters, and they connect just fine during the install test, but I don't think these are required since my computers I've got this working don't even have those ODBC adapters installed, only defaults.
5) Some internet searching indicates a DNS issue, but i'm using the server's literal local IP in the string, so it has no need to do DNS lookups, I don't think this is the issue.
My main system I want to install it on is running Windows 10 Pro with the latest .net installed, so updating that wasn't an option.
I'm just wondering what would cause the program to run properly through a VPN, but not on the local network, where I assumed everything is trusted?
Any suggestions would be appreciated.
Thank you!
I wrote a Database program using c# and MariaDB. That is working great on my development system, Windows 10 Pro with LocalHost Database.
When it came time to move the program into production (Server 2016 Server with Domain Controller) I changed the source to the Server's internal IP but I get the following fatal error;
Unable to connect to any of the specified MySQL hosts
However, with some testing I noticed the program works great, when I VPN in using a system not connected to the Domain. Very odd.
Here is the MySQL statement (one combination of many throughout):
MySqlConnection con = new MySqlConnection("server=19
So, with the client user logged in, and the program on the desktop, I did some trouble shooting:
1) Configured incoming and outgoing TCP and UDP ports of 3306, and eventually disabled the whole Windows Firewall
2) Disabled and eventually removed Kaspersky AV Business
3) Moved the code to another Server, the Domain Controller, and did the same test and had the same result
4) I've installed MySQL and MariaDB ODBC adapters, and they connect just fine during the install test, but I don't think these are required since my computers I've got this working don't even have those ODBC adapters installed, only defaults.
5) Some internet searching indicates a DNS issue, but i'm using the server's literal local IP in the string, so it has no need to do DNS lookups, I don't think this is the issue.
My main system I want to install it on is running Windows 10 Pro with the latest .net installed, so updating that wasn't an option.
I'm just wondering what would cause the program to run properly through a VPN, but not on the local network, where I assumed everything is trusted?
Any suggestions would be appreciated.
Thank you!
ASKER
Hi Ryan,
That's interesting...I remoted in and installed the telnet client on the Windows 10 system, and when I entered in the command it got kinda crazy, this was the output:
5.5.5-10.4.10-MariaDBY2)w@uPo■≈!]ea97F=*vmysql _native_pa ssword
Connection to host lost.
C:\Users\administrator>
So it connected, and once I pressed a key, it said connection lost.
I can also connect just fine from any computer to the Host MySQL Server, (.12.9), using Heidi SQL which is the management software, with no problems.
I'm currently looking into side loading apps, but when I select sideloaded apps from the menu, it does not seem to make a difference. Maybe I need a group policy from the Domain Controller too? I'm not sure:
This is what it looks like:
At first I was unable to select a different option with the radio button, but then I found this registry key:
Computer\HKEY_LOCAL_MACHIN E\SOFTWARE \Microsoft \Windows\C urrentVers ion\AppMod elUnlock
And set it to '1'....I was then able to move the radio button to SideLoad Apps, from the default selection of Microsoft Store Apps.
Again though, the program still does not run...so thinking maybe group policy?
That's interesting...I remoted in and installed the telnet client on the Windows 10 system, and when I entered in the command it got kinda crazy, this was the output:
5.5.5-10.4.10-MariaDBY2)w@uPo■≈!]ea97F=*vmysql
Connection to host lost.
C:\Users\administrator>
So it connected, and once I pressed a key, it said connection lost.
I can also connect just fine from any computer to the Host MySQL Server, (.12.9), using Heidi SQL which is the management software, with no problems.
I'm currently looking into side loading apps, but when I select sideloaded apps from the menu, it does not seem to make a difference. Maybe I need a group policy from the Domain Controller too? I'm not sure:
This is what it looks like:
At first I was unable to select a different option with the radio button, but then I found this registry key:
Computer\HKEY_LOCAL_MACHIN
And set it to '1'....I was then able to move the radio button to SideLoad Apps, from the default selection of Microsoft Store Apps.
Again though, the program still does not run...so thinking maybe group policy?
Did you check on both sides inbound and outbound firewall rules?
https://serverfault.com/questions/823877/mysql-connection-not-working-with-windows-firewall-on
https://serverfault.com/questions/823877/mysql-connection-not-working-with-windows-firewall-on
mysql> GRANT ALL PRIVILEGES ON database.* TO '<account>'@'localhost' IDENTIFIED BY '<password>';
be sure you dont have different firewall rules for domain and non domain connections, sometimes windows connections cannot determine they are on domain because a DNS hiccup or wrong tcp/ip configuration so they use the PRIATE or PUBLIC network profiles for the firewall which are usually set to block many things, this happened to me once and I was getting crazy trying to find the reason , as we have the firewall off for domain and on for everything else, also turning off the windows firewall service many times prevented us from connecting anywhere, we had to turn on service but turn off rules
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
isn't that the same connection string that you specified in your first post?
ASKER
Thank you again!
ASKER
Hi arana,
I've used both connection strings throughout the project.
When the Main Form loads, I had the datasource connecting, and when other forms load, I used the other string.
Sorry for the oversight on this one, I really wasn't thinking it had anything to do with the connection string since I had the code working fine on my dev systems.
I've used both connection strings throughout the project.
When the Main Form loads, I had the datasource connecting, and when other forms load, I used the other string.
Sorry for the oversight on this one, I really wasn't thinking it had anything to do with the connection string since I had the code working fine on my dev systems.
in many cases the parameter names (USERNAME vs UID, Server vs DATASOURCE) depend on the version of the driver installed or if you are using ODBC or OLEDB
for example:
Open in new window