I just loaded my first Blazor solution to Azure. Using Visual Studio, I developed on my local laptop with two databases. One for security, another for data.
I have successfully deployed everything to the free Azure service created, and my local build reads data from the online Azure databases. But when I run the application online, it comes up with an error. Looking at the browser terminal it seems that the online system is expecting the database to be on my local machine.
1>------ Build started: Project: ContakLibrary, Configuration: Release Any CPU ------
2>------ Build started: Project: ContakDB, Configuration: Release Any CPU ------
2> ContakDB -> C:\Users...\VisualStudioDevProjects\ContakProject\ContakDB\bin\Release\ContakDB.dll
2> ContakDB -> C:\Users...\VisualStudioDevProjects\ContakProject\ContakDB\bin\Release\ContakDB.dacpac
Excerpt from error in browser:
blazor.server.js:19 [2020-08-11T20:21:04.671Z] Error: System.Data.SqlClient.SqlException (0x80131904): Could not find stored procedure 'dbo.spLandingSiteGet'.
at Dapper.SqlMapper.QueryAsync[T](IDbConnection cnn, Type effectiveType, CommandDefinition command) in /_/Dapper/SqlMapper.Async.cs:line 419
at ContakLibrary.DataAccess.SqlDataAccess.LoadData[T,U](String storedProcedure, U parameters, String connectionStringName) in C:\Users...\VisualStudioDevProjects\ContakProject\ContakLibrary\DataAccess\SqlDataAccess.cs
Any help would be greatly appreciated.
Make sure that the table structure, function, and stored procedure in localdb and azure sql database are consistent.
You need to find
Connection strings in your project. It should be found in
.json file. Not hard coding in the code.
Then you can add new connection string in portal, and set the value of production environment.
The settings in the Portal have higher priority than the settings in the project configuration file. This helps local debugging and protects the database security of the production environment.
User contributions licensed under CC BY-SA 3.0