Search This Blog

Monday, June 14, 2021

Q26-Q30

Q26. What is the use of appsettings.json in .net core?
Q27. What are user secrets in .net core?
Q28. What is reverse proxy server .net core?
Q29. What is the use of launchSettings.json file in .net core?
Q30. What is the difference between  MapWhen and Map in dotnet 8?

==========================================================================================
Q26. What is the use of appsettings.json in .net core?

Answer:
1) Used to store configuration settings such as connection string, application level global variable, logging level configurations etc
2) We can store JWT key in appsettings.json file but it is NOT advisable. it can be saved here for temporary development phase. 
3) appSettings.json file could be environment specific as well. appsettings.<environment>.json

==========================================================================================
Q27. What are user secrets in .net core?

Answer:
If we do not want to share the secrets like API keys, connection string, connection information to cloud service (azure, aws) etc to anyone who can clone your project. 

For this .net core has given an option of user secret file which is outside the project tree structure. you can manage this file by right click the project and choose manage secrets option. 

Secret.json is the file which will be created to store secrets. 




==========================================================================================
Q28. What is reverse proxy server .net core?

Answer:
1) reverse proxy came into picture when we are using kestral server in .net core. 
2) Kestrel can be used by itself or with a reverse proxy server, such as Internet Information Services (IIS), Nginx, or Apache. A reverse proxy server receives HTTP requests from the network and forwards them to Kestrel.



==========================================================================================
Q29. What are the use of launchSettings.json file in .net core?

Answer:
launchSetting.json under property folder is mainly for local development. 
Hosted application url in local, Environment variables are part of launchSettings.json file. 


==========================================================================================
Q30. What is the difference between Map and MapWhen in dotnet 8?

Answer:
Both Map and MapWhen are used to branch middleware pipeline. 

Map: 
This method is used to branch the pipeline based on specific requested path. 

app.Map("/maptest", HandleMapTest);

MapWhen:
Enables branching pipeline. Runs specified middleware if condition is met.


    app.MapWhen(context => {
        return context.Request.Query.ContainsKey("somekey");
    }, HandleBranch);
==========================================================================================

No comments:

Post a Comment

Q36-Q40(EF)

Q36.  What is the difference between Include and Join in entity framework? Q37. What will be your approach in case you want to call a manual...