my app is deployed and responds (however, no db connection) but, the pages that do not connect to the database work correctly, including calls to the web service api
my mysql database is running and has a public ip address (also, added my ip address as an authorized network)
i can connect to the google database from my local laptop using the mysql workbench and the instance i created is fully loaded and ready
i am able to run my .net core 3.1 project from my local machine and it runs using the Google MySQL instance via the public ip address
unsure why i am able to run my app locally using the google mysql instance from my laptop but the app from within the google hosting network itself does not.
google claims it should work by default?
however, the only way i have gotten it to work is by adding 0.0.0.0/0 to the allowed network. seems "dirty" that way. but, if i must.
connection string is "Server=34.125.xxx.xxx;Database=testdb;Uid=root;Password=testpword"
error message
You have already gone through the issue yourself. You have tried to make 0.0.0.0/0 an authorized network and it worked! what does this mean? This simply means that you need to authorize the AppEngine outbound NAT gateway cidr to access your CloudSQL instance and it worked because this NAT cidr is included in 0.0.0.0/0 as you may already know.
but the thing is, this is not the best option to secure your connection to CloudSQL.
As quoted from the documentation:
Using the Cloud SQL Auth proxy is the recommended method for authenticating connections to a Cloud SQL instance because it's the most secure method.
The CloudSQL Auth proxy provides secure access to your instances without a need for Authorized networks or for configuring SSL.
See the CloudSQL Auth proxy documentation here
Also,
You do not need to use the Cloud SQL Auth proxy or configure SSL to connect to Cloud SQL from App Engine standard environment or App Engine flexible environment.
See
Connecting from AppEngine standard environment to CloudSQL
and Connecting from AppEngine flexible environment to CloudSQL
Related
I am having an issue connecting to my web api (via Postman)from a separate computer on the same network. I am Able to connect (Via Postman) if I am working on the same computer where the API is located. However When I attempt to connect to the same API (Via Postman) on a separate computer (within the same network). I receive an error stating
"Could not Send response
ECONNREFUSED"
I have tried to unblock SSL certificates.
I have also tried to add bindings to the applicationhost.config file
Neither of these have worked for me.
As a side note, The API does not have any Authentication associated with it so my guess is it has something to do with access to the web server where the API is housed.
Any help would be greatly appreciated
Connect through Ip Address That should work.
For Example
on local it should be like this
http://localhost:8050/ParseXml
On Remote or other Pc
http://10.45.0.38:8050/ParseXml
Another thing is did you check if your system can successfully ping that system?
Now I develop a WPF application that access to Azure SQL Server and work in Windows10 Tablet for my client.
I registered my client IP address of my PC for development,so the application can access to the sql server in development.
But it does not work in the tablet in other network. I know, I have to register its ip address too.
Now I have a problem.. of course, my client use his own network and I can't confirm the ip address he use!
To resolve this problem, I tried to use Azure AD autehntication with token.
(refer to https://learn.microsoft.com/en-us/azure/sql-database/sql-database-aad-authentication , https://techcommunity.microsoft.com/t5/azure-sql-database/azure-ad-service-principal-authentication-to-sql-db-code-sample/ba-p/481467 and so on)
My Application suceeded to login with Azure AD authentication in my PC for development, but in other network it failed yet..
Does it mean that I have to register the ip address in which the application works in any authentication method?
(If yes, it means that all user have to tell his own ip address to developer. No Way!!)
or I need to allow all range of ip address for this application?
I hope your help, thanks
If I understand your question correctly there are two questions:
1. How to make sure that dev machine has access to Azure SQL Database ?
For this, there is no other way. You will have to enable the IP addresses (or range of addresses) from which you want to access the Azure SQL database. If it is not allowed, you will not be able to connect to it.
You can enable this either while creating the SQL Azure instance OR you can also configure these IP addresses later as and when you need.
If you ask me what is the best way, I would suggest to use your local SQL Server for development. That way you do not need to configure all the IP addresses from all the networks from where you can work. This is also very handy as you have database on your machine.
Are you using central database and many people using it, then you have option to either setup a SQL Server which is available to the development team.
Alternatively, if you are interested to use Azure SQL for your development (which I would not recommend), then you can also try setting up a proxy service which just forwards the request to Azure SQL. That way making sure that all requests are coming from one IP.
2. How to make sure that your deployed application will always be able to access Azure SQL database?
It depends on how the application is deployed. If the application is going to be deployed in Azure, then you may want to enable access from other Azure services to Azure SQL instance. This is also setting which you can enable while creating SQL Azure database OR You can configure it after creating the SQL Azure instance.
If the application is not on Azure but database is on Azure, you will have to update the firewall to allow connections from the application.
I hope this provides you enough insights to get to your solution.
How can we use google cloud database for local.net web application without deployed .net app on google cloud?
You can connect directly to Cloud SQL using either of the following options:
whitelisting your IP address and connect using the Public IP of your instance
you can run the Cloud SQL proxy locally which will forward the traffic to the instance
I have added a database via phpmyadmin on a server. I can access it via http://ipaddress/phpmyadmin . but when i try using those credentials to connect to that db on a c# app , i get the error : unable to retrieve the list of database.
I don't have the right to access the server. I have a user who has rights to two db which i can see when i remotely connect to that server's phpmyadmin. Is it possible that i have right to the db just via phpmyadmin but can't access it via app because i don't have the right to do it because mysql is forbidding it ? I also have a raspberry pi handy. is using it as a db server a better alternative than this ?
Since phpMyAdmin runs on a web server, most people install it on the same machine the database is running on and access it remotely through the network. That means their phpMyAdmin is communicating with MySQL locally, often without the connection leaving the server. Your C# application, on the other hand, is a compiled application that would likely run on your client machine, not the server - meaning any connection from the application to the database is occurring through the network (or internet, depending again on your configuration). Since exposing the MySQL port is generally a bad idea, your MySQL may be configured to only listen locally, or you may have a firewall or NAT connection blocking you from even reaching the server. If that's the case, you may need to rethink how you'll communicate with the database (oftentimes exposing an API is a better solution than opening port 3306 to the world).
It's also possible you're using two different user accounts. To MySQL, an individual user account consists not only of the username, but also the hostname. You can use a wildcard hostname (%) which means all hosts, except it's really "all hosts connecting via TCP/IP networking connection."
It's possible that your application and your phpMyAdmin are using two different connection methods; one using TCP/IP and the other using sockets. Check which phpMyAdmin is using (the easiest way to do so is to look at the host phpMyAdmin is connecting to; 'localhost' is a socket connection and '127.0.0.1' is networking). Configure your C# application the same way.
I am hosting my site on a shared server and wants to move my database to azure for better manageability. I created a database and added some data on azure platform. I tried to connect to that database through my local computer and it works. But when I am trying the same connection string on a shared hosting servers it gives me resource not found 505 error. Why?
For security reasons when you setup an Azure SQL DB it only allows connections from IP Addresses that you specify. Before recent enhancements to the portal, this required you to manually add your local IP Address and a loopback for anything hosted on Azure.
Since you are hosting your web site on a 3rd party provider you probably just need to find out the IP Address where your site is hosted and add that to the 'whitelist' of IP addresses that Azure SQL DB maintains. After you do that, it should just work.