Total Page Preview:   000000000219

What is appsetting.json file in Asp.Net Core MVC in English and Hindi

appsetings.json file in English

In ASP.NET Core MVC, the appsettings.json file is a configuration file used to store various settings and configuration values for your application. These settings can include things like connection strings, API keys, logging configuration, and other application-specific parameters. The file is a part of the broader configuration system in ASP.NET Core, which allows you to centralize and manage your application's configuration settings.
Here's a brief overview of how appsettings.json works:
1-File Location: The appsettings.json file is typically located in the root directory of your ASP.NET Core project. You can have multiple appsettings.json files for different environments, such as appsettings.Development.json and appsettings.Production.json, to manage settings specific to those environments.
2-JSON Format: The file is written in JSON (JavaScript Object Notation) format. It consists of key-value pairs, where the keys are strings representing the setting names and the values can be strings, numbers, booleans, arrays, or nested objects.
3-Accessing Settings: You can access the settings in the appsettings.json file using the IConfiguration interface, which is available through dependency injection in ASP.NET Core. This interface provides methods to read configuration values.
Here's an example of an appsettings.json file:
appsettings.json is a powerful way to configure your application without hardcoding values directly into your code. It provides flexibility and allows you to change settings without modifying and recompiling your application.
 
 
appsetings.json file in Hindi
ASP.NET Core MVC mein, appsettings.json ek configuration file hota hai jisme aapke application ke alag-alag settings aur configuration values store hote hain. Ye settings connection strings, API keys, logging configuration, aur anya application-specific parameters jaise cheezein shamil ho sakti hain. Ye file ASP.NET Core ke broader configuration system ka hissa hota hai, jisse aap apne application ke configuration settings ko ek sthan par rakhkar manage kar sakte hain.
 
Yahan appsettings.json ka kuch mukhya points hain:
1-File Location: appsettings.json file aam taur par aapke ASP.NET Core project ke root directory mein hoti hai. Aap alag-alag environments ke liye multiple appsettings.json files rakhte hain, jaise ki appsettings.Development.json aur appsettings.Production.json, jo un environments ke liye specific settings ko manage karne mein madad karti hain.
2-JSON Format: Ye file JSON (JavaScript Object Notation) format mein likhi hoti hai. Isme key-value pairs hote hain, jahan keys setting names ko represent karte hain aur values strings, numbers, booleans, arrays, ya nested objects ho sakte hain.
3-Settings Tak Pahuch: Aap IConfiguration interface ka istemal karke appsettings.json ke settings ko access kar sakte hain, jo ki ASP.NET Core mein dependency injection ke through uplabdh hota hai. Ye interface configuration values ko padhne ke liye methods pradan karta hai.
Yahan ek appsettings.json file ka example hai:
appsettings.json aapke application ko configure karne ka powerful tareeka hai bina values ko seedhe code mein hardcode kiye. Isse flexibility milti hai aur aap settings ko modify kiye bina apne application ko modify aur recompile kiye change kar sakte hain.
 
 
 
 
 

Thank You

About Author

Brijesh Kumar

Database Developer

I have more then 6 years Experience in Microsoft Technologies - SQL Server Database, ETL Azure Cloud - Azure SQL Database, CosmosDB, Azure Data Factory, PowerBI, Web Job, Azure Function, Azure Storage, Web Apps, Powershall and Database Migration On-Premise to Azure Cloud.
LinkedIn : https://www.linkedin.com



Comments


                           
                           

                           

                           

Facebook User: