从本地EF数据库迁移到Google Cloud

时间:2017-11-25 09:50:01

标签: c# asp.net database entity-framework google-cloud-sql

故事:

我正在尝试创建一个托管在Google Cloud上的ASP.NET应用程序。

此应用程序需要数据库访问才能存储一些数据,我已使用Entity Framework访问本地数据库。

所以我按照本教程,希望找到一种在Google Cloud上托管我的数据库的方法: https://cloud.google.com/dotnet/docs/getting-started/using-cloud-sql

但是在第六步中的配置设置部分,我收到错误。

配置:

文件:Web.config

<appSettings>
    <add key="GoogleCloudSamples:ProjectId" value="area-185910" />
    <add key="GoogleCloudSamples:BookStore" value="mysql" />
</appSettings>
<connectionStrings>
    <add name="AreaDbEntities" connectionString="metadata=res://*/Models.AreaModel.csdl|res://*/Models.AreaModel.ssdl|res://*/Models.AreaModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(LocalDB)\MSSQLLocalDB;attachdbfilename=|DataDirectory|\AreaDb.mdf;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    <add name="LocalMySqlServer" connectionString="Server=IP;Database=NAME;Uid=USERNAME;Pwd=USERPWD" providerName="MySql.Data.MySqlClient" />
</connectionStrings>

错误:

Visual studio Error

网站的页面错误:

[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: SQL Network Interfaces, error: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)]

问题:

是否有人能够解释如何从本地EF数据库(使用实体框架)迁移到Google Cloud?

或者有人能够解决错误吗?

提前谢谢!

0 个答案:

没有答案