Deploy ASP.NET MVC app on Azure portal with SQL database


How I can move my local database in project in order that I can deploy this database to Azure? Know on Azure when I login I get an error:

Error: an error occurred while processing your request

It is because I have no connection to my database. I have created the database on Azure portal but it's empty. How can I connect to my database from my app so that it works?

enter image description here

This is the complete error:

[Win32Exception (0x80004005): The system cannot find the file specified]

[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.)]
[EntityException: The underlying provider failed on Open.]

The solution: When you deploy app click 'Publish' - > 'Create new Profile' -> In field 'Explore additional Azure Services' click - > 'Create a SQL Database'

asked on Stack Overflow May 1, 2020 by Kamil Stępniewski • edited May 5, 2020 by Kamil Stępniewski

1 Answer


According your comment, you problem turned to be deploy database to Azure.

There are many ways you can to that.

Since you have created the database on Azure portal, the easiest way is that you can using SSMS Deploy Database wizard:

enter image description here

For more details, you could reference this tutorial: Learn how to Migrate a SQL Server database to SQL Azure server.

Once the database is deployment to Azure SQL database successfully, you could get the connection string on Azure SQL database page on Portal:

enter image description here

Ref:Get ADO.NET connection information (optional)

hope this helps.

answered on Stack Overflow May 4, 2020 by Leon Yue

User contributions licensed under CC BY-SA 3.0