I wrote an app in ASP.NET Core MVC with CRUD to deploy to Azure, using code first. I followed this tutorial: https://learn.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-dotnet-sqldatabase
The tutorial is slightly out of date, but I am confident that I followed it properly. I also attempted to literally follow the tutorial with the sample app, and I got the same problem. I can provide an image, but the error page isn't very descriptive. It says:
Error: an error occurred while processing your request.
Request ID: |bac57a49-4ca7848aebbdb3cb.
Development Mode
Swapping to Development environment will display more detailed information about the error that occurred.The Development environment shouldn't be enabled for deployed applications. It can result in displaying sensitive information from exceptions to end users. For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development and restarting the app.
To be blunt, I have no idea on how to proceed. I feel like there is a problem with the connection string, because the site works except when you hit a page that accesses the database. In the appsettings.json
file, the only connection string available is the following:
"ConnectionStrings": {
"PostContext": "Server=(localdb)\\mssqllocaldb;Database=PostContext-1;Trusted_Connection=True;MultipleActiveResultSets=true"
}
I wasn't necessarily expecting VS2019 to add a connection string on it's own, but this wasn't a step in the tutorial, so I didn't touch it myself.
I have also noticed that there are a few questions that seem related, but there also doesn't seem to be a clear answer. There was a solution from 2018, this, that referenced a hosting model issue, but that was over 2 years ago.
Any help or direction would be appreciated.
EDIT: I used the application logging system in azure. this is the response:
2020-09-11 22:57:18.620 +00:00 [Error]
Microsoft.EntityFrameworkCore.Database.Command: Failed executing DbCommand (5ms)
[Parameters=[], CommandType='Text', CommandTimeout='30']
SELECT [p].[Two], [p].[OneAgent], [p].[OneDate], [p].[OnePartyId], [p].[OneStage], [p].[OneTitle]FROM [PostOnes] AS [p]
and another error:
2020-09-11 22:57:18.644 +00:00 [Error] Microsoft.EntityFrameworkCore.Query:
An exception occurred while iterating over the results of a query for context type 'RyneAura.Data.PostContext'.Microsoft.Data.SqlClient.SqlException
(0x80131904): Invalid object name 'PostOnes'.at
Microsoft.Data.SqlClient.SqlCommand.<>c. [...]
I'm not sure what they mean.