[Mono-list] Sharing Web.config among webapps/services

Joe Audette joe_audette@yahoo.com
Thu, 4 Nov 2004 07:27:45 -0800 (PST)


--0-1500469038-1099582065=:32190
Content-Type: text/plain; charset=us-ascii

I'm not using XSP. I have this working under mono with mod_mono and apache, the only difference is my referenced file is in the same folder with the Web.config file so not sure about ../../ but I thought it would work.
 
Mine is like this
<appSettings file="user.config">
    <add key="myKey" value="somePrivateValue" />
</appSettings>
 
Where user.config is in the same folder with Web.config
In this scenario the setting from user.config is used in preference to the same setting in Web.config
 
Under mono, if I make a change in Web.config or user.config I have to killall mono to make it see the changes.
Under Windows it detects changes to Web.config but not changes to user.config
 
I would suggest 2 experiments.
1. Name the referenced file something other than Web.config as this name has special context, try main.config or something like that.
2. See if it works in the same folder with the Web.config instead of ../../
 
Hope that helps,
 
Joe Audette


Mariano Alarcon <marianoa@itcsoluciones.com> wrote:
Thanks Joe,

I tried your suggestion, but it did not work. I created a Web.config 
file inside WebApp1 and added the following:





I can read the value of "myKey" but not the the settings defined in 
../../Web.config. Do you mean that it works for you with IIS or mono?

If I point xsp to mainDir I can read both values but I still have the 
problem that I have to move all the dlls up to mainDir...


Joe Audette wrote:

> Another way to do it is in the Web.config, reference another config 
> file like this
> Web.config:
> 
> 
> Then the settings in the referenced MyWeb.config will take precedence 
> over the settings in the calling Web.config
> Not sure if that helps but it does work
> 
> Joe Audette
>
> */Mariano Alarcon /* wrote:
>
> Yes, but maybe WebApps have Web.config files of their own which I
> would
> like to take precedence. If I do links I only get one Web.config file.
>
> Dan Maltes wrote:
>
> > Perhaps file links would work?
> >
> >-Dan
> >
> >-----Original Message-----
> >From: mono-list-admin@lists.ximian.com
> >[mailto:mono-list-admin@lists.ximian.com] On Behalf Of Mariano
> Alarcon
> >Sent: Tuesday, November 02, 2004 11:50 AM
> >To: mono-list@ximian.com
> >Subject: [Mono-list] Sharing Web.config among webapps/services
> >
> >Hello,
> >
> >Is it posible to set up xsp/mod_mono so they can share the same
> Web.config
> >file? So far I have been able to make this happen but it requires
> that I
> >move all the codebehind binaries to the main directory.
> >For example I tried:
> >
> >|
> >+-MainDir
> > |
> > + - Web.config (to be shared by WebApp1 and WebApp2)
> > |
> > +- WebApp1
> > | |
> > | +- WebApp1.asmx
> > | |
> > | +- bin
> > | |
> > | +- WebApp1.dll
> > |
> > +- WebApp2
> > |
> > +- WebApp2.asmx
> > |
> > +- bin
> > |
> > + WebApp2.dll
> >
> >With this configuration if I point my xsp to MainDir I get the
> following:
> >
> >Server error in '/' application
> >
> >Type WebApp.WebApp1 not found.
> >Description: Error processing request.
> >
> >Error Message: HTTP 500. Type WebApp.WebApp1 not found.
> >
> >Starting two xsps at /WebApp1 and /WebApp2 deals with the error
> but I do not
> >get the common settings in Web.config. It also works if I move
> WebApp1.dll
> >and WebApp2.dll to a /bin directory under MainDir but I was
> hoping I could
> >keep the structure like the example above.
> >
> >Is this possible?
> >
> >Thanks.
> >
> >_______________________________________________
> >Mono-list maillist - Mono-list@lists.ximian.com
> >http://lists.ximian.com/mailman/listinfo/mono-list
> >
> >
> >
> >
> >
> >
>
> -- 
> Mariano Alarcón
> ITC Soluciones
>
> _______________________________________________
> Mono-list maillist - Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
>
>
> joe_audette@yahoo.com
> http://www.joeaudette.com
> http://www.mojoportal.com 


-- 
Mariano Alarcón
ITC Soluciones



joe_audette@yahoo.com
http://www.joeaudette.com
http://www.mojoportal.com
--0-1500469038-1099582065=:32190
Content-Type: text/html; charset=us-ascii

<DIV>I'm not using XSP. I have this working under mono with mod_mono and&nbsp;apache, the only difference is my referenced file is in the same folder with the Web.config file so not sure about ../../ but I thought it would work.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Mine is like this</DIV>
<DIV>&lt;appSettings file="user.config"&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;add key="myKey" value="somePrivateValue" /&gt;<BR>&lt;/appSettings&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Where user.config is in the same folder with Web.config</DIV>
<DIV>In this scenario the setting from user.config is used in preference to the same setting in Web.config</DIV>
<DIV>&nbsp;</DIV>
<DIV>Under mono, if I make a change in Web.config or user.config&nbsp;I have to killall mono to make it see the changes.</DIV>
<DIV>Under Windows it detects changes to Web.config but not changes to user.config</DIV>
<DIV>&nbsp;</DIV>
<DIV>I would suggest 2 experiments.</DIV>
<DIV>1. Name the referenced file something other than Web.config as this name has special context, try main.config or something like that.</DIV>
<DIV>2. See if it works in the same folder with the Web.config instead of ../../</DIV>
<DIV>&nbsp;</DIV>
<DIV>Hope that helps,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Joe Audette<BR><BR><BR><B><I>Mariano Alarcon &lt;marianoa@itcsoluciones.com&gt;</I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">Thanks Joe,<BR><BR>I tried your suggestion, but it did not work. I created a Web.config <BR>file inside WebApp1 and added the following:<BR><BR><APPSETTINGS file="../../Web.config"><BR><ADD value="somePrivateValue" key="myKey" /><BR></APPSETTINGS><BR><BR>I can read the value of "myKey" but not the the settings defined in <BR>../../Web.config. Do you mean that it works for you with IIS or mono?<BR><BR>If I point xsp to mainDir I can read both values but I still have the <BR>problem that I have to move all the dlls up to mainDir...<BR><BR><BR>Joe Audette wrote:<BR><BR>&gt; Another way to do it is in the Web.config, reference another config <BR>&gt; file like this<BR>&gt; Web.config:<BR>&gt; <APPSETTINGS file="../MyWeb.config"><BR>&gt; <BR>&gt; Then the settings in the referenced MyWeb.config will take precedence <BR>&gt; over the settings in the calling Web.config<BR>&gt; Not su
 re if
 that helps but it does work<BR>&gt; <BR>&gt; Joe Audette<BR>&gt;<BR>&gt; */Mariano Alarcon <MARIANOA@ITCSOLUCIONES.COM>/* wrote:<BR>&gt;<BR>&gt; Yes, but maybe WebApps have Web.config files of their own which I<BR>&gt; would<BR>&gt; like to take precedence. If I do links I only get one Web.config file.<BR>&gt;<BR>&gt; Dan Maltes wrote:<BR>&gt;<BR>&gt; &gt; Perhaps file links would work?<BR>&gt; &gt;<BR>&gt; &gt;-Dan<BR>&gt; &gt;<BR>&gt; &gt;-----Original Message-----<BR>&gt; &gt;From: mono-list-admin@lists.ximian.com<BR>&gt; &gt;[mailto:mono-list-admin@lists.ximian.com] On Behalf Of Mariano<BR>&gt; Alarcon<BR>&gt; &gt;Sent: Tuesday, November 02, 2004 11:50 AM<BR>&gt; &gt;To: mono-list@ximian.com<BR>&gt; &gt;Subject: [Mono-list] Sharing Web.config among webapps/services<BR>&gt; &gt;<BR>&gt; &gt;Hello,<BR>&gt; &gt;<BR>&gt; &gt;Is it posible to set up xsp/mod_mono so they can share the same<BR>&gt; Web.config<BR>&gt; &gt;file? So far I have been able to make this happen but it
 requires<BR>&gt; that I<BR>&gt; &gt;move all the codebehind binaries to the main directory.<BR>&gt; &gt;For example I tried:<BR>&gt; &gt;<BR>&gt; &gt;|<BR>&gt; &gt;+-MainDir<BR>&gt; &gt; |<BR>&gt; &gt; + - Web.config (to be shared by WebApp1 and WebApp2)<BR>&gt; &gt; |<BR>&gt; &gt; +- WebApp1<BR>&gt; &gt; | |<BR>&gt; &gt; | +- WebApp1.asmx<BR>&gt; &gt; | |<BR>&gt; &gt; | +- bin<BR>&gt; &gt; | |<BR>&gt; &gt; | +- WebApp1.dll<BR>&gt; &gt; |<BR>&gt; &gt; +- WebApp2<BR>&gt; &gt; |<BR>&gt; &gt; +- WebApp2.asmx<BR>&gt; &gt; |<BR>&gt; &gt; +- bin<BR>&gt; &gt; |<BR>&gt; &gt; + WebApp2.dll<BR>&gt; &gt;<BR>&gt; &gt;With this configuration if I point my xsp to MainDir I get the<BR>&gt; following:<BR>&gt; &gt;<BR>&gt; &gt;Server error in '/' application<BR>&gt; &gt;<BR>&gt; &gt;Type WebApp.WebApp1 not found.<BR>&gt; &gt;Description: Error processing request.<BR>&gt; &gt;<BR>&gt; &gt;Error Message: HTTP 500. Type WebApp.WebApp1 not found.<BR>&gt; &gt;<BR>&gt; &gt;Starting two xsps at /We
 bApp1
 and /WebApp2 deals with the error<BR>&gt; but I do not<BR>&gt; &gt;get the common settings in Web.config. It also works if I move<BR>&gt; WebApp1.dll<BR>&gt; &gt;and WebApp2.dll to a /bin directory under MainDir but I was<BR>&gt; hoping I could<BR>&gt; &gt;keep the structure like the example above.<BR>&gt; &gt;<BR>&gt; &gt;Is this possible?<BR>&gt; &gt;<BR>&gt; &gt;Thanks.<BR>&gt; &gt;<BR>&gt; &gt;_______________________________________________<BR>&gt; &gt;Mono-list maillist - Mono-list@lists.ximian.com<BR>&gt; &gt;http://lists.ximian.com/mailman/listinfo/mono-list<BR>&gt; &gt;<BR>&gt; &gt;<BR>&gt; &gt;<BR>&gt; &gt;<BR>&gt; &gt;<BR>&gt; &gt;<BR>&gt;<BR>&gt; -- <BR>&gt; Mariano Alarcón<BR>&gt; ITC Soluciones<BR>&gt;<BR>&gt; _______________________________________________<BR>&gt; Mono-list maillist - Mono-list@lists.ximian.com<BR>&gt; http://lists.ximian.com/mailman/listinfo/mono-list<BR>&gt;<BR>&gt;<BR>&gt;<BR>&gt; joe_audette@yahoo.com<BR>&gt; http://www.joeaudette.com<BR>&g
 t;
 http://www.mojoportal.com <BR><BR><BR>-- <BR>Mariano Alarcón<BR>ITC Soluciones<BR><BR></BLOCKQUOTE><BR><BR>joe_audette@yahoo.com<br>http://www.joeaudette.com<br>http://www.mojoportal.com
--0-1500469038-1099582065=:32190--