An error occurred using the connection to database 'myDb' on server 'tcp:xx.xxx.xxx.xx'. SQLServer - Google Cloud

0

I'm having a problem deploying my app. The error, below, says that there is an error connecting to the database. Here is my connection string:

"Server=tcp:'sql server public IP';Database=MyDB;User Id=sqlserver;Password=passwd"

The strange thing is that, when I connect through my local computer, adding a firewall rule, everything is ok, but when trying to connect to the Google Cloud server, it gives this error. If anyone can help me, I appreciate it.

ERROR: (gcloud.app.deploy) Error Response: [9] Application startup error! Code: APP_CONTAINER_CRASHED [40m[1m[33mwarn[39m[22m[49m: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] No XML encryptor configured. Key {59e7d5ed-be7f-4680-94d6-65c08cd5b7df} may be persisted to storage in unencrypted form.

[41m[30mfail[39m[22m[49m: Microsoft.EntityFrameworkCore.Database.Connection[20004]

An error occurred using the connection to database 'MyDB' on server 'tcp:sql serve public IP'.

[41m[30mfail[39m[22m[49m: Microsoft.EntityFrameworkCore.Query[10100]

An exception occurred while iterating over the results of a query for context type 'MyProject.Data.NoVolanteContext'.

Microsoft.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 40 - Could not open a connection to SQL Server) at Microsoft.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling, String accessToken, DbConnectionPool pool, SqlAuthenticationProviderManager sqlAuthProviderManager) at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) at Microsoft.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) at Microsoft.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) at Microsoft.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) at Microsoft.Data.ProviderBase.DbConnectionPool.WaitForPendingOpen()

sql-server
cloud
google
database-connection

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0