Web. config and application. config in WCF development

Source: Internet
Author: User
Tags hosting

WCF uses the System.Configuration Configuration System of the. NET Framework.

When configuring a service in Visual Studio, use either a Web. config file or an app. config file to specify the settings. The choice of the configuration file name is determined by the hosting environment your choose for the service. If you are using the IIS to host your service, use a Web. config file. If you is using any other hosting environment, use an app. config 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 assembly name. For example, an assembly named "Cohowinery.exe" have a final configuration file name of "Cohowinery.exe.config". However, you have need to modify the app. Config file. Changes made to that file is automatically made to the final application configuration file at compile time.

In using an app. config, file the configuration system merges the. config file with content of the Machine.config file W Hen the application starts and the configuration is applied. This mechanism allows Machine-wide settings to being defined in the Machine.config file. The app. Config file can used to override the settings of the Machine.config file; You can also lock in the settings in Machine.config file so that they get used. In the Web. config case, the configuration system merges the Web. config files in all directories leading the Applicat Ion directory into the configuration that gets applied. For more information on the configuration and the setting priorities, see topics in the System.Configuration namespace.

Extracted from msdn:https://msdn.microsoft.com/en-us/library/ms733932 (v=vs.110). aspx

Web. config and application. config in WCF development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.