I don't have Startup.cs and appsettings.jason files in my solution explorer , how can I implement database connection into my project



While creating an ASP.NET MVC project with AngularJS, the appsettings.json and startup.cs files are missing. Is there any way to create them or any another options to get connection from database..?


appsettings.json and Startup.cs are for ASP.NET Core applications, your ASP.NET MVC must be targetting ASP.NET Framamework, so to connect to the database recides in Web.config.

It should be added to <connectionStrings> section after <configSections> section in <configuration> block.

    <add name="DefaultContext" connectionString="data source=ServerName;initial catalog=DatabaseName;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />

You can read more at Docs

Answered By – Nishan

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More