Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2005

Tip: Looking for answers? Try searching our database.

appdomain configuration file error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
hB - 17 Jul 2005 09:57 GMT
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­onfigurationSystemBase.EnsureI­nit()
System.Web.HttpRuntime.InitCon­figuration(HttpContext context)
System.Web.HttpRuntime.FirstRe­questInit(HttpContext 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.GetType("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/stories/2002/07/12/executingAspxPage...

in my code:
msh ASPNetHost.CreateApplicationHo­st(Type.GetType("url.ASPNetHos­t"),
"/",Directory.GetCurrentDirect­ory()+"\\web",Directory.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
Juan T. Llibre - 17 Jul 2005 13:49 GMT
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/default.asp?url=/library/en-us/cpref/html/frlr
fsystemappdomainsetupclassconfigurationfiletopic.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...
======================

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­onfigurationSystemBase.EnsureI­nit()
System.Web.HttpRuntime.InitCon­figuration(HttpContext context)
System.Web.HttpRuntime.FirstRe­questInit(HttpContext 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.GetType("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/stories/2002/07/12/executingAspxPage...

in my code:
msh =
ASPNetHost.CreateApplicationHo­st(Type.GetType("url.ASPNetHos­t"),
"/",Directory.GetCurrentDirect­ory()+"\\web",Directory.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
hB - 26 Jul 2005 08:01 GMT
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.FullName,
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.SetConfigurationSystem(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.HttpConfigurationSystemBase.EnsureInit()
  System.Web.HttpRuntime.InitConfiguration(HttpContext context)
  System.Web.HttpRuntime.FirstRequestInit(HttpContext context)

[HttpException (0x80004005): ASP.NET Initialization Error]
  System.Web.HttpRuntime.FirstRequestInit(HttpContext context)
  System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest 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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.