467,867 Members | 1,518 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,867 developers. It's quick & easy.

appdomain configuration file error

hB
Hi.
Error = "The configuration system can only be set once. Configuration
system is already set"
Exception Details: System.InvalidOperationExcepti*on: The
configuration
system can only be set once. Configuration system is already set
....
System.Web.Configuration.HttpC*onfigurationSystemB ase.EnsureI*nit()
System.Web.HttpRuntime.InitCon*figuration(HttpCont ext context)
System.Web.HttpRuntime.FirstRe*questInit(HttpConte xt context)
....
I am not on IIS. I am hosting ASP dotnet, in a dotnet console
applicaiton.
The console app has its own default app domain.
When i create as
ApplicationHost.CreateApplicat*ionHost(Type.GetTyp e("url.ASPN*etHost"),

"/",Directory.GetCurrentDirect*ory());
it worx fine.
but when i create myself an appdomain //due to some reason regarding
[web]application base directory
....loDomain = AppDomain.CreateDomain(domainI*d, null, setup);...
as mentioned in here (reference)
http://radio.weblogs.com/0105476/sto...cutingAspxPage...

in my code:
msh =
ASPNetHost.CreateApplicationHo*st(Type.GetType("ur l.ASPNetHos*t"),
"/",Directory.GetCurrentDirect*ory()+"\\web",Directo ry.GetCur*rentDirectory());

and when i do
msh.ProcessRequest(file_name, query,tw);
Then this error comes when i use my own appdomain creation.
I think this is some one console exe with its domian create another
appdomain with its (need to be separately own) configuraiton file
(which is there or not there does gives problem) (i do AppDomainSetup
setup = new AppDomainSetup(); | setup.ConfigurationFile = "web.config";

BUT IT gives same problem)
I hope you guys understand.
Thanks in advance
Awaiting replies.
regards,
---
hB

Nov 19 '05 #1
  • viewed: 2143
Share:
3 Replies
Hi, hB.

Maybe it would help to review these links :

Application Domain FAQ :
http://www.gotdotnet.com/team/clr/AppdomainFAQ.aspx

There's also good info here :
http://www.andymcm.com/dotnetfaq.htm

Finally, there's example code at :
http://msdn.microsoft.com/library/de...nfiletopic.asp


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"hB" <ha*********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi.
Error = "The configuration system can only be set once. Configuration
system is already set"
Exception Details: System.InvalidOperationExcepti*on: The
configuration
system can only be set once. Configuration system is already set
....
System.Web.Configuration.HttpC*onfigurationSystemB ase.EnsureI*nit()
System.Web.HttpRuntime.InitCon*figuration(HttpCont ext context)
System.Web.HttpRuntime.FirstRe*questInit(HttpConte xt context)
....
I am not on IIS. I am hosting ASP dotnet, in a dotnet console
applicaiton.
The console app has its own default app domain.
When i create as
ApplicationHost.CreateApplicat*ionHost(Type.GetTyp e("url.ASPN*etHost"),

"/",Directory.GetCurrentDirect*ory());
it worx fine.
but when i create myself an appdomain //due to some reason regarding
[web]application base directory
....loDomain = AppDomain.CreateDomain(domainI*d, null, setup);...
as mentioned in here (reference)
http://radio.weblogs.com/0105476/sto...cutingAspxPage...

in my code:
msh =
ASPNetHost.CreateApplicationHo*st(Type.GetType("ur l.ASPNetHos*t"),
"/",Directory.GetCurrentDirect*ory()+"\\web",Directo ry.GetCur*rentDirectory());

and when i do
msh.ProcessRequest(file_name, query,tw);
Then this error comes when i use my own appdomain creation.
I think this is some one console exe with its domian create another
appdomain with its (need to be separately own) configuraiton file
(which is there or not there does gives problem) (i do AppDomainSetup
setup = new AppDomainSetup(); | setup.ConfigurationFile = "web.config";

BUT IT gives same problem)
I hope you guys understand.
Thanks in advance
Awaiting replies.
regards,
---
hB
Nov 19 '05 #2
hB
Its not just a simple appdomain configuration problem.

I am doing it this way, may some errors in it.
Code fragment:
--------------------------------------------------------------------------
string aspDir = HttpRuntime.AspInstallDirectory;
string domainId = "ASPHOST_" +
DateTime.Now.ToString().GetHashCode().ToString("x" );
string appName = (virtualDir +
physicalDir).GetHashCode().ToString("x");
AppDomainSetup setup = new AppDomainSetup();
setup.ApplicationName = appName;
setup.ConfigurationFile = "app.config";
if (ApplicationBase != null && ApplicationBase != "")
setup.ApplicationBase = ApplicationBase;
AppDomain loDomain = AppDomain.CreateDomain(domainId, null, setup);
loDomain.SetData(".appDomain", "*");
loDomain.SetData(".appPath", physicalDir);
loDomain.SetData(".appVPath", virtualDir);
loDomain.SetData(".domainId", domainId);
loDomain.SetData(".hostingVirtualPath", virtualDir);
loDomain.SetData(".hostingInstallDir", aspDir);
System.Runtime.Remoting.ObjectHandle oh =
loDomain.CreateInstance(hostType.Module.Assembly.F ullName,
hostType.FullName);
ASPNetHost loHost = (ASPNetHost) oh.Unwrap();
loHost.cVirtualPath = virtualDir;
loHost.cPhysicalDirectory = physicalDir;
loHost.oAppDomain = loDomain;
return loHost;
--------------------------------------------------------------------------

when quering from my internet client (browser) as http://localhost/
i get this error

Server Error in '/' Application.
--------------------------------------------------------------------------------
The configuration system can only be set once. Configuration system is
already set.
Exception Details: System.InvalidOperationException: The configuration
system can only be set once. Configuration system is already set.

Stack Trace:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
[InvalidOperationException: The configuration system can only be set
once. Configuration system is already set]

System.Configuration.ConfigurationSettings.SetConf igurationSystem(IConfigurationSystem
configSystem)

[TargetInvocationException: Exception has been thrown by the target of
an invocation.]
System.Reflection.RuntimeMethodInfo.InternalInvoke (Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters,
CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean
verifyAccess) +0
System.Reflection.RuntimeMethodInfo.InternalInvoke (Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters,
CultureInfo culture, Boolean verifyAccess)
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
System.Web.Configuration.HttpConfigurationSystemBa se.EnsureInit()
System.Web.HttpRuntime.InitConfiguration(HttpConte xt context)
System.Web.HttpRuntime.FirstRequestInit(HttpContex t context)

[HttpException (0x80004005): ASP.NET Initialization Error]
System.Web.HttpRuntime.FirstRequestInit(HttpContex t context)
System.Web.HttpRuntime.ProcessRequestInternal(Http WorkerRequest wr)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Main Application Thread (MT in a console based app with TcpListener)
MT -> creates appdomain. (for asp.net)
The class in appdomain.doSoProcessRequest() //proxy call. and then this
error comes upon first call to it by proxy call cross appdomain.
Thanks.

Nov 19 '05 #3
hB
Its not just a simple appdomain configuration problem.

I am doing it this way, may some errors in it.
Code fragment:
--------------------------------------------------------------------------
string aspDir = HttpRuntime.AspInstallDirectory;
string domainId = "ASPHOST_" +
DateTime.Now.ToString().GetHashCode().ToString("x" );
string appName = (virtualDir +
physicalDir).GetHashCode().ToString("x");
AppDomainSetup setup = new AppDomainSetup();
setup.ApplicationName = appName;
setup.ConfigurationFile = "app.config";
if (ApplicationBase != null && ApplicationBase != "")
setup.ApplicationBase = ApplicationBase;
AppDomain loDomain = AppDomain.CreateDomain(domainId, null, setup);
loDomain.SetData(".appDomain", "*");
loDomain.SetData(".appPath", physicalDir);
loDomain.SetData(".appVPath", virtualDir);
loDomain.SetData(".domainId", domainId);
loDomain.SetData(".hostingVirtualPath", virtualDir);
loDomain.SetData(".hostingInstallDir", aspDir);
System.Runtime.Remoting.ObjectHandle oh =
loDomain.CreateInstance(hostType.Module.Assembly.F ullName,
hostType.FullName);
ASPNetHost loHost = (ASPNetHost) oh.Unwrap();
loHost.cVirtualPath = virtualDir;
loHost.cPhysicalDirectory = physicalDir;
loHost.oAppDomain = loDomain;
return loHost;
--------------------------------------------------------------------------

when quering from my internet client (browser) as http://localhost/
i get this error

Server Error in '/' Application.
--------------------------------------------------------------------------------
The configuration system can only be set once. Configuration system is
already set.
Exception Details: System.InvalidOperationException: The configuration
system can only be set once. Configuration system is already set.

Stack Trace:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
[InvalidOperationException: The configuration system can only be set
once. Configuration system is already set]

System.Configuration.ConfigurationSettings.SetConf igurationSystem(IConfigurationSystem
configSystem)

[TargetInvocationException: Exception has been thrown by the target of
an invocation.]
System.Reflection.RuntimeMethodInfo.InternalInvoke (Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters,
CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean
verifyAccess) +0
System.Reflection.RuntimeMethodInfo.InternalInvoke (Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters,
CultureInfo culture, Boolean verifyAccess)
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
System.Web.Configuration.HttpConfigurationSystemBa se.EnsureInit()
System.Web.HttpRuntime.InitConfiguration(HttpConte xt context)
System.Web.HttpRuntime.FirstRequestInit(HttpContex t context)

[HttpException (0x80004005): ASP.NET Initialization Error]
System.Web.HttpRuntime.FirstRequestInit(HttpContex t context)
System.Web.HttpRuntime.ProcessRequestInternal(Http WorkerRequest wr)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Main Application Thread (MT in a console based app with TcpListener)
MT -> creates appdomain. (for asp.net)
The class in appdomain.doSoProcessRequest() //proxy call. and then this
error comes upon first call to it by proxy call cross appdomain.
Thanks.

Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Lauren Hines | last post: by
1 post views Thread by Cider123 | last post: by
6 posts views Thread by Wal Turner | last post: by
3 posts views Thread by Christopher Robert | last post: by
3 posts views Thread by Alexander van Doormalen | last post: by
4 posts views Thread by =?Utf-8?B?SmFu?= | last post: by
10 posts views Thread by =?Utf-8?B?U3RlZmFuIEJhcmxvdw==?= | last post: by
reply views Thread by jack112 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.