ASP.NET Code💻 First Project Common Issues

  1. How to install a Database?
  2. How to run the migration?
  3. Database table not created?
  4. How to add/modify the DB connection sting in the appsettings.json file?
  5. Error: Invalid object name ‘DefaultIdentityOptions’.
  6. How to check the MSSQL server name?
ASP.NET Core Project Common Issue

Solutions/Guideline:

Please follow these steps,

1. Make sure the right database connection is in the appsettings.json file.

2. Check your server running properly and get the server name by running this SQL Query:

select @@SERVERNAME as 'Server Name';

Here SERVERNAME in appsettings.json,
Server=DESKTOP-99Q87I2\MSSQLSERVER2017

3. Delete the database from your SQL Management Studio (if already created)

No need to create migration rules and update the database. You just need to build and run the application. Already initial migration rule is included with the project. Please make sure the MS SQL server running properly.

4. Just build the project (As we have already included Migrations in the project)

5. Run the project

6. Now check your Database. Hopefully, the Database and all the tables you will find now.

7. Please cross-check the program.cs and appsettings.json files properly.

appsettings.json

8. Example Connection String:

"connMSSQL": "Server=DESKTOP-HLGBAEE\\MSSQLSERVER2017;Database=BusinessERP;User ID=sa;Password=123;MultipleActiveResultSets=true",

Note that,
Server = your local server
Database = any name
User ID=your local MSSQL Server user name
Password=your local MSSQL Server user password

Tutorials Video:
ASP .NET Core | Database Connection | Entity Framework Core | Code First | MSSQL

9. DB Migration: [if required]

Tools → Nuget Package Manager → Package Manager Console
PM> add-migration initcreate
PM> update-database

10. Check .Net Version:

Press Windows + R.
Type cmd. Open the command prompt,
On the command prompt, type dotnet — — version

Dynamic Database Connection String: [Red marked string name must be same]

👋 .NET Application Collections
🚀 My Youtube Channel
💻 Github

If you want to modify or add new features, you can always contact us at,
📲 WhatsApp: 8801674411603
📢 Telegram: shahed71bd
📢 Skype: shahedatomap
🙏 Email: shahedbddev@gmail.com
♾️ Web: https://netspeedm.com/