Reputation: 167
Please, I am new to this process.
I have successfully published my app to Azure via Visual Studio's publishing process. The data did not deploy. I created the database in Azure it does exists. But my data isn't deploying to it. When I try and log into my app, I'm getting an error because my user settings table is not there.
What are my options?
Thanks,
CM
Upvotes: 0
Views: 60
Reputation: 27997
As far as I know, if you set the azure sql database when you create the project. It will not automatic change the default connection string in your web config.
The web config:
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-testdb2-20170503021124.mdf;Initial Catalog=aspnet-testdb2-20170503021124;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
So all your data is stored in the local. When you publish the project, it will not automatic copy all the data to the azure sql database.
You need migrate your SQL Server database to Azure SQL Database.
You could firstly export your local db to BACPAC file. Then you could use powershell to import the BACPAC file to the azure sql server.
More details, you could refer to this article.
Besides, I suggest you change the connection string in the local next time, if you want store your test data in the azure sql database.
You could find the connection string by click the publish button.
In its settings tag, you could find the connectionstring as below. Then you could change the local webconfig's connection string.
Upvotes: 2