0
我在Mac上使用Visual Studio代码构建了asp.net MVC Core web应用程序。该应用程序一直在本地主机上使用数据库(EF)。如何使用Mac上的Visual Studio代码将数据库发布到Azure?
我有创建Web App + SQL数据库的Azure帐户。然后我将appsetting.json
中的连接字符串更改为Azure SQL数据库提供的连接字符串。
使用git push azure master
命令将网站部署到Azure Web App。但是如何将数据库发布到Azure?
在appsetting.json
:
"ConnectionStrings": {
"AzureConnection": "Server=tcp:myapp-test.database.windows.net,1433;Initial Catalog=myapp-test;Persist Security Info=False;User ID=***;Password=***;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
}
输出I运行dotnet ef database update
后:
bash-3.2$ dotnet ef database update
Project MyApp (.NETCoreApp,Version=v1.0) will be compiled because project is not safe for incremental compilation. Use --build-profile flag for more information.
Compiling BlueJacket for .NETCoreApp,Version=v1.0
Bundling with configuration from /Users/matt/Documents/MyApp/bundleconfig.json
Processing wwwroot/css/site.min.css
Processing wwwroot/js/site.min.js
Compilation succeeded.
0 Warning(s)
0 Error(s)
Time elapsed 00:00:05.1136780
(The compilation time can be improved. Run "dotnet build --build-profile" for more information)
Done.
是的,我已经创建了一个数据库连接字符串添加到'appsetting.json'了。 – Matt
我使用命令'dotnet ef数据库更新',但仍然无法正常工作? – Matt
这是什么意思?你可以添加详细的 –