MVC Published web application gives page error in transaction containing database!?

Zeynep BARAN 21 Reputation points
2021-09-02T07:37:39.337+00:00

Hello,
I created a web application with ASP.NET Core MVC technology, where I created the database using Entity Framework and Sql Management Studio. In the most general sense, I created every stage of my project, which consists of a login page, admin page and user pages.
I Published my project using Web Deploy methods with IIS so that I can present it as a demo in the company.
I can see my project with a few problems. But when I perform operations on the Web Page that I need to connect to the Database, I get the following error.
When I look at the resources to fix the error, it says SQL> Security>login>new login to define the specified user and authorize the database. When I perform the steps, I still get the error I shared below. I'm using the local database I created via Migration and I've made the configuration settings.
How can I get it resolved. This is my first project, it is very important in terms of presentation. Please help.

128427-mvc-publish-error-1.png128604-mvc-publish-error-2.png128428-mvc-publish-error-3.png128605-mvc-publish-error-4.png

Developer technologies | ASP.NET | ASP.NET Core
Microsoft 365 and Office | Development | Microsoft 365 Publishing
0 comments No comments
{count} votes

Answer accepted by question author
  1. AgaveJoe 30,411 Reputation points
    2021-09-02T18:00:32.373+00:00

    BROADCAST\TEKNIK-PC1$ is a service account, correct? Be sure to set the IIS application pool identity to BROADCAST\TEKNIK-PC1$. Your connection string will use Trusted_Connection=True and the application pool identity (BROADCAST\TEKNIK-PC1$) will pass the service account to login. If you are still having issues then contact your AD account admin for assistance.

    You are correct using the SA account is considered insecure. As a matter of fact, any security assessment will consider an active SA account an active security risk.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Duane Arnold 3,216 Reputation points
    2021-09-02T08:43:40.417+00:00

    IMO, the easiest thing to do is use the 'sa' account and password to logon to the database, which is the system administrator account for all MS SQL Server databases that on your development machine.

    Then you can go to the appsettings.json file for the MVC project in Visual Stuido to use the SA and password on the connectionstring in the appsetttings.json file, which is a text file.

    connetionString="Data Source=ServerName;
    Initial Catalog=DatabaseName;User ID=UserName;Password=Password"

    http://csharp.net-informations.com/data-providers/csharp-sql-server-connection.htm

    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.