Getting Access Violation every time I modified web.config

  • Thread starter Thread starter Raymon Du
  • Start date Start date
R

Raymon Du

Hi,

I am getting the following exception every time I modified web.config, the
only way to fix it is to recycle application pool or restart IIS, but I
don't want to do that all the times. TIA
 
I don't understand your response at all. Don't modify web.config at all?
Where do you suggest me to connection strings? Har coded in some .cs files?
It's a common practice to store connection strings into web.config then
change them for switching to defferent environments. But ASP.Net runtime
throws exceptions if connection strings are changed in my case.
 
re:
!> I don't understand your response at all. Don't modify web.config at all?

He didn't say that at all.
He said "If you don't want your ASP.NET application to recycle, don't modify web.config".

If you modify web.config, your ASP.NET application *will* recycle.

re:
!> Where do you suggest me to connection strings?
!> Har coded in some .cs files?

No, but you could have a helper config file named connections.config, for example.

<connectionStrings configSource="connections.config"/>

To enable the configuration to be recognized on any change to "connections.config",
edit machine.config, in the <configSections> section, and edit <section name="connectionStrings" ... >,
adding : restartOnExternalChanges="true"

That'd make it :

<section name="connectionStrings" type="System.Configuration.AppSettingsSection, System.Configuration,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" restartOnExternalChanges="true"
requirePermission="false" />




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================

Raymon Du said:
I don't understand your response at all. Don't modify web.config at all? Where do you suggest me to connection
strings? Har coded in some .cs files? It's a common practice to store connection strings into web.config then change
them for switching to defferent environments. But ASP.Net runtime throws exceptions if connection strings are changed
in my case.
 
Back
Top