Getting Access Violation every time I modified web.config

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

.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.AccessViolationException: Attempted to read or
write protected memory. This is often an indication that other memory is
corrupt.

Source Error:


[No relevant source lines]


Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\aspdotnetstorefront70\8208fb2b\b0ed0a81\App_global.asax.kh-ttsyu.0.cs
Line: 0

Stack Trace:


[AccessViolationException: Attempted to read or write protected memory. This
is often an indication that other memory is corrupt.]
ASP.global_asax..ctor() in
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\aspdotnetstorefront70\8208fb2b\b0ed0a81\App_global.asax.kh-ttsyu.0.cs:0

[TargetInvocationException: Exception has been thrown by the target of an
invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean
publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle&
ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean
fillCache) +103
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean
skipVisibilityChecks, Boolean fillCache) +268
System.Activator.CreateInstance(Type type, Boolean nonPublic) +66
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder
binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
+1036
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr,
Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttributes) +114
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr
appContext, HttpContext context) +197
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance() +27
System.Web.HttpApplicationFactory.FireApplicationOnStart(HttpContext
context) +3460678
System.Web.HttpApplicationFactory.EnsureAppStartCalled(HttpContext
context) +125
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext
context) +99
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +350
 
R

Raymon Du

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.
 
J

Juan T. Llibre

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" />






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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top