Issue
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..?
Solution
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.
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="DefaultContext" connectionString="data source=ServerName;initial catalog=DatabaseName;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
</connectionStrings>
You can read more at Docs
Answered By - Nishan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.