What’s the difference between App.conf and Web.conf?

Asked

Viewed 508 times

2

  • What is the difference between the App.conf and the Web.conf?

2 answers

4


On this topic, the author of the reply commented:

Web.config and App.config

The choice of configuration file name is determined by the hosting environment you choose for the service. If you are using IIS to host your service, use a Web.config file. If you’re using any other hosting environment, use an app file.

In Visual Studio, the file named App.config is used to create the final configuration file. The final name actually used for the configuration depends on the name of Assembly. For example, a mount with the name "Coho Winery.exe" has a name of "Coho Winery.exe.config" final configuration file. However, you just need to modify the app file. Changes made to the file are automatically made to the final application configuration file at build time.

In using an App.config, archiving the configuration system merges the App.config file with the contents of the Machine.config file when the application starts and the configuration is applied. This mechanism allows the whole machine settings to be set in the Machine.config file. The App.config file can be used to override the Machine.config file settings; you can also lock the settings in the Machine.config file for them to get used to. In the case of Web.config, the configuration system merges the Web.config files into all directories that point to the application directory for the configuration that will be applied.

See the documentation on the Microsoft website here

1

In accordance with reply in English in the OS:

Web.Config is used for web projects Asp.net / web services.

App.Config is used for Windows Forms, Windows Services, console applications and WPF applications.

That is to say:

  • If your app is hosted with IIS, use web.config.

  • If your application is Windows, use app.config.

We use Web.Config on Asp.net web projects or web services, and App.Config we use in Windows Forms, Windows Services, console and WPF applications.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.