我使用 Asp.NET Core 创建了简单的应用程序。它使用 Entity Framework 和本地数据库。我将我的应用程序部署到 Google Cloud App Engine,但老实说我不知道如何处理我的数据库。现在我正在使用本地 sql 服务器
我的 appSettings.json 看起来像这样:
{
"connectionStrings": {
"smogInfoDBConnectionString": "Server=(localdb)\\mssqllocaldb;Database=SmogInfoDB;Trusted_Connection=True",
"hangfireConnectionString": "Server=(LocalDB)\\MSSQLLocalDB;Integrated Security=true"
}
}
当我在我的电脑上调试和使用应用程序时,它工作得很好。我知道我需要创建一个 SQL 实例,但是如何将我的应用程序连接到该数据库服务器?如何制作连接字符串?
最佳答案
您与 Google Cloud SQL 的连接字符串应如下所示:
Server=xxx.xxx.xxx.xxx;Database=DB_NAME;Uid=USER_NAME;Password=PASSWORD
关于c# - 将 ASP.NET Core 应用程序连接到 Google Cloud SQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51069034/