Answer 1)
Any change in Web.config
file will cause ASP.NET application to restart. But, it is possible to create
one or more external .config files which don't cause application restart. To
connect external .config files with main Web.config, use configSource parameter.
Here is an example code snippet, used to read external configuration from three
files:
<connectionStrings configSource="db.config"/> <appSettings configSource="app.config"/>
<system.net> <mailSettings> <smtp configSource="mail.config"/> </mailSettings> </system.net>
So, in this example, we
can change connection strings, application settings and mail settings.
Application will not restart when any of these files change. Any external
.config file should contain only section where is called. For example,
db.config is called from <connectionStrings />
and should contain only connection strings, like this:
<connectionStrings> <clear /> <add name="ConnStringName" connectionString="Data Source=myServerAddress;Initial
Catalog=myDataBase;Integrated Security=SSPI;" providerName="Syste.Data.SqlClient"/> </connectionStrings>
|