473,783 Members | 2,475 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

appdomain configuration file error

hB
Hi.
Error = "The configuration system can only be set once. Configuration
system is already set"
Exception Details: System.InvalidO perationExcepti *on: The
configuration
system can only be set once. Configuration system is already set
....
System.Web.Conf iguration.HttpC *onfigurationSy stemBase.Ensure I*nit()
System.Web.Http Runtime.InitCon *figuration(Htt pContext context)
System.Web.Http Runtime.FirstRe *questInit(Http Context 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.G etType("url.ASP N*etHost"),

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

in my code:
msh =
ASPNetHost.Crea teApplicationHo *st(Type.GetTyp e("url.ASPNetHo s*t"),
"/",Directory.Get CurrentDirect*o ry()+"\\web",Di rectory.GetCur* rentDirectory() );

and when i do
msh.ProcessRequ est(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.Configura tionFile = "web.config ";

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

Nov 19 '05 #1
3 2390
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*********@gm ail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
Hi.
Error = "The configuration system can only be set once. Configuration
system is already set"
Exception Details: System.InvalidO perationExcepti *on: The
configuration
system can only be set once. Configuration system is already set
....
System.Web.Conf iguration.HttpC *onfigurationSy stemBase.Ensure I*nit()
System.Web.Http Runtime.InitCon *figuration(Htt pContext context)
System.Web.Http Runtime.FirstRe *questInit(Http Context 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.G etType("url.ASP N*etHost"),

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

in my code:
msh =
ASPNetHost.Crea teApplicationHo *st(Type.GetTyp e("url.ASPNetHo s*t"),
"/",Directory.Get CurrentDirect*o ry()+"\\web",Di rectory.GetCur* rentDirectory() );

and when i do
msh.ProcessRequ est(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.Configura tionFile = "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.Asp InstallDirector y;
string domainId = "ASPHOST_" +
DateTime.Now.To String().GetHas hCode().ToStrin g("x");
string appName = (virtualDir +
physicalDir).Ge tHashCode().ToS tring("x");
AppDomainSetup setup = new AppDomainSetup( );
setup.Applicati onName = appName;
setup.Configura tionFile = "app.config ";
if (ApplicationBas e != null && ApplicationBase != "")
setup.Applicati onBase = ApplicationBase ;
AppDomain loDomain = AppDomain.Creat eDomain(domainI d, null, setup);
loDomain.SetDat a(".appDomain ", "*");
loDomain.SetDat a(".appPath", physicalDir);
loDomain.SetDat a(".appVPath" , virtualDir);
loDomain.SetDat a(".domainId" , domainId);
loDomain.SetDat a(".hostingVirt ualPath", virtualDir);
loDomain.SetDat a(".hostingInst allDir", aspDir);
System.Runtime. Remoting.Object Handle oh =
loDomain.Create Instance(hostTy pe.Module.Assem bly.FullName,
hostType.FullNa me);
ASPNetHost loHost = (ASPNetHost) oh.Unwrap();
loHost.cVirtual Path = virtualDir;
loHost.cPhysica lDirectory = physicalDir;
loHost.oAppDoma in = 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.InvalidO perationExcepti on: The configuration
system can only be set once. Configuration system is already set.

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

System.Configur ation.Configura tionSettings.Se tConfigurationS ystem(IConfigur ationSystem
configSystem)

[TargetInvocatio nException: Exception has been thrown by the target of
an invocation.]
System.Reflecti on.RuntimeMetho dInfo.InternalI nvoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters,
CultureInfo culture, Boolean isBinderDefault , Assembly caller, Boolean
verifyAccess) +0
System.Reflecti on.RuntimeMetho dInfo.InternalI nvoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters,
CultureInfo culture, Boolean verifyAccess)
System.Reflecti on.RuntimeMetho dInfo.Invoke(Ob ject obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
System.Reflecti on.MethodBase.I nvoke(Object obj, Object[] parameters)
System.Web.Conf iguration.HttpC onfigurationSys temBase.EnsureI nit()
System.Web.Http Runtime.InitCon figuration(Http Context context)
System.Web.Http Runtime.FirstRe questInit(HttpC ontext context)

[HttpException (0x80004005): ASP.NET Initialization Error]
System.Web.Http Runtime.FirstRe questInit(HttpC ontext context)
System.Web.Http Runtime.Process RequestInternal (HttpWorkerRequ est wr)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Main Application Thread (MT in a console based app with TcpListener)
MT -> creates appdomain. (for asp.net)
The class in appdomain.doSoP rocessRequest() //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.Asp InstallDirector y;
string domainId = "ASPHOST_" +
DateTime.Now.To String().GetHas hCode().ToStrin g("x");
string appName = (virtualDir +
physicalDir).Ge tHashCode().ToS tring("x");
AppDomainSetup setup = new AppDomainSetup( );
setup.Applicati onName = appName;
setup.Configura tionFile = "app.config ";
if (ApplicationBas e != null && ApplicationBase != "")
setup.Applicati onBase = ApplicationBase ;
AppDomain loDomain = AppDomain.Creat eDomain(domainI d, null, setup);
loDomain.SetDat a(".appDomain ", "*");
loDomain.SetDat a(".appPath", physicalDir);
loDomain.SetDat a(".appVPath" , virtualDir);
loDomain.SetDat a(".domainId" , domainId);
loDomain.SetDat a(".hostingVirt ualPath", virtualDir);
loDomain.SetDat a(".hostingInst allDir", aspDir);
System.Runtime. Remoting.Object Handle oh =
loDomain.Create Instance(hostTy pe.Module.Assem bly.FullName,
hostType.FullNa me);
ASPNetHost loHost = (ASPNetHost) oh.Unwrap();
loHost.cVirtual Path = virtualDir;
loHost.cPhysica lDirectory = physicalDir;
loHost.oAppDoma in = 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.InvalidO perationExcepti on: The configuration
system can only be set once. Configuration system is already set.

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

System.Configur ation.Configura tionSettings.Se tConfigurationS ystem(IConfigur ationSystem
configSystem)

[TargetInvocatio nException: Exception has been thrown by the target of
an invocation.]
System.Reflecti on.RuntimeMetho dInfo.InternalI nvoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters,
CultureInfo culture, Boolean isBinderDefault , Assembly caller, Boolean
verifyAccess) +0
System.Reflecti on.RuntimeMetho dInfo.InternalI nvoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters,
CultureInfo culture, Boolean verifyAccess)
System.Reflecti on.RuntimeMetho dInfo.Invoke(Ob ject obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
System.Reflecti on.MethodBase.I nvoke(Object obj, Object[] parameters)
System.Web.Conf iguration.HttpC onfigurationSys temBase.EnsureI nit()
System.Web.Http Runtime.InitCon figuration(Http Context context)
System.Web.Http Runtime.FirstRe questInit(HttpC ontext context)

[HttpException (0x80004005): ASP.NET Initialization Error]
System.Web.Http Runtime.FirstRe questInit(HttpC ontext context)
System.Web.Http Runtime.Process RequestInternal (HttpWorkerRequ est wr)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

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

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3014
by: Silvia | last post by:
I have this code in web.config file <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="dllredirect"/> <codeBase href="http://localhost/dllrecirect/dllredirect.dll" /> </dependentAssembly> </assemblyBinding>
2
10850
by: Lauren Hines | last post by:
Hello, I have read numerous post stating that the only way to unload an assembly (DLL in my case) is to create a separate AppDomain, load the assembly, then unload it by calling AppDomain.Unload. When trying to delete the DLL file I get an exception that access is denied. When trying to copy over the DLL file, I get an exception that it is being used by another process.
1
2492
by: Cider123 | last post by:
The following is a basic example of how this system works: C:\MyApp\Application1.exe C:\MyApp\MyMonitor.exe In SQL Server, we keep an EXE (Application1.exe) file stored as binary. I read this out of SQL Server into a byte array (through MyMonitor.exe) and then pass to a function for Version.
6
8200
by: Wal Turner | last post by:
Hi there. There are various snippets on forums regarding issues with AppDomain.Unload and how it just doesnt work. Fortunately, I got it working with the base case, after much fiddling. Consider this 5 line program: AppDomain domain = AppDomain.CreateDomain("MyDomain"); domain.CreateInstance("TempDLL", "TempDLL.Class1"); MessageBox.Show("try deleting file now"); //cant delete file AppDomain.Unload(domain);
3
6757
by: Christopher Robert | last post by:
Hi, folks, I've just installed Visual Studio 2005 on my XP Pro (SP2) environment and the new ASP.NET 2.0 doesn't seem to be running well in my IIS. Every time I try to load up a .aspx page (even if it's just flat HTML), I get the "server application unavailable" error, accompanied by two bits in the event log. One is an error: Failed to execute request because the App-Domain could not be created. Error: 0x80131902
3
1970
by: Alexander van Doormalen | last post by:
I have a windows service which calls extensions. In 1 of those extensions I want to load a config file (extension.dll.config). In that config file I defined some ConfigurationSection's. For example: <section name="somename" type="sonenamespace.someclassname, someassembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/> The loading part is done using ConfigurationManager.OpenMappedExeConfiguration(ExeConfigurationFileMap,...
1
6436
by: Jess Chadwick | last post by:
I am attempting to use the Enterprise Library (Jan 2006) Cryptography block to encrypt a credit card number in my ASP.NET 2.0 Commerce Server application. Everything is configured correctly, as evidenced by the fact that it is running on a production box using the same web.config (but not the same parent web.config). When I call the EncryptSymmetric() method, I get this error: Server Error in '/Store' Application....
4
4475
by: =?Utf-8?B?SmFu?= | last post by:
I have a .NET 2.0 application divided in two assemblies; the exe and a dll. The application generates a plugin-dll which is then loaded in a separate AppDomain (along with a second instance of my application dll). It's been working for months and now the it's not working from my application exe anymore but still working from NUnit when testing the dll. What could have changed in my exe? Some configuration thing in my VS2005 project?
10
7601
by: =?Utf-8?B?U3RlZmFuIEJhcmxvdw==?= | last post by:
This has been working perfectly for months. Since we switched from ASP.NET 1.1 to 2.0, we have constant and sporadic issues with updating our applications. Touching the web.config works about 40% of the time to cause an AppDomain to reload and flush all assemblies. Sometimes it works perfectly, but other times some Assemblies are not reloaded into the AppDomain, even after multiple web.config file touches. Sometimes multiple versions...
0
10315
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10083
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9946
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.