|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Splitting WCF ServiceHost configurations into separate files?Hi,
I have several ServiceHost instances each implemented in its own DLL. The services are being self-hosted by a forms application. I'd like to split the ServiceHost configuration parameters that are all currently held in App.config into separate files so allowing the service configurations to be managed more easily. The only way I can see to do this is to subclass ServiceHost and implement my own XML based configuration sub-system but this seems insane. Does anyone know an easy way to do this? Thanks, Steve. You talking about something like this??
<?xml version = "1.0" encoding = "utf-8" ?> <configuration> <configSections> <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data"/> </configSections> <appSettings file="CustomAppSettings.config" > </appSettings> <connectionStrings configSource="ExternalConnectionStrings.config" /> <dataConfiguration defaultDatabase="MainDatabaseConnectionString"/> <system.serviceModel> <behaviors configSource="WCFBehaviors.config"> </behaviors> <bindings configSource="WCFBindings.config"> </bindings> <client configSource="WCFClient.config" > </client> <services configSource="WCFServices.config" > </services> </system.serviceModel> <system.diagnostics configSource="SystemDiagnostics.config"> </system.diagnostics> </configuration> "bindings configSource" and "system.serviceModel" and I think you'll find the same URL I did about it. <jonesst2***@googlemail.com> wrote in message Show quote news:1192628051.255390.151900@t8g2000prg.googlegroups.com... > Hi, > > I have several ServiceHost instances each implemented in its own DLL. > The services are being self-hosted by a forms application. > > I'd like to split the ServiceHost configuration parameters that are > all currently held in App.config into separate files so allowing the > service configurations to be managed more easily. > > The only way I can see to do this is to subclass ServiceHost and > implement my own XML based configuration sub-system but this seems > insane. > > Does anyone know an easy way to do this? > > Thanks, Steve. > Hi,
That's a step in the right direction. Ideally I want to keep the <service>, <serviceBehaviors> ... etc in a service specific configuration file, eg ServiceA.dll is entirely configured by ServiceA.config. I'm wondering if my self-hosting parent application could programmatically change configSource="ServiceX.config" before instantiating the specific service X. I'll have to investigate. Thanks. Show quote On 17 Oct, 15:08, "sloan" <sl***@ipass.net> wrote: > You talking about something like this?? > > <?xml version = "1.0" encoding = "utf-8" ?> > <configuration> > > <configSections> > <section name="dataConfiguration" > type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, > Microsoft.Practices.EnterpriseLibrary.Data"/> > </configSections> > > <appSettings file="CustomAppSettings.config" > > </appSettings> > > <connectionStrings configSource="ExternalConnectionStrings.config" /> > > <dataConfiguration defaultDatabase="MainDatabaseConnectionString"/> > > <system.serviceModel> > > <behaviors configSource="WCFBehaviors.config"> > </behaviors> > > <bindings configSource="WCFBindings.config"> > </bindings> > > <client configSource="WCFClient.config" > > </client> > > <services configSource="WCFServices.config" > > </services> > > </system.serviceModel> > > <system.diagnostics configSource="SystemDiagnostics.config"> > </system.diagnostics> > > </configuration> > > "bindings configSource" and "system.serviceModel" > and I think you'll find the same URL I did about it. > > <jonesst2***@googlemail.com> wrote in message > > news:1192628051.255390.151900@t8g2000prg.googlegroups.com... > > > Hi, > > > I have several ServiceHost instances each implemented in its own DLL. > > The services are being self-hosted by a forms application. > > > I'd like to split the ServiceHost configuration parameters that are > > all currently held in App.config into separate files so allowing the > > service configurations to be managed more easily. > > > The only way I can see to do this is to subclass ServiceHost and > > implement my own XML based configuration sub-system but this seems > > insane. > > > Does anyone know an easy way to do this? > > > Thanks, Steve. Well, a config file is just a fancy xml document, so that's possible.
I went the other route I think. When I have several different projects, I end up having the app.config file of the Host(er) as seen below. Then I've written some el-crappo code to merge different app's into the single WCFService.config file. If you figure out anything, post a follow up (probably in a new thread, or it'll get lost). ... As a side note, you may want to look at the msdn.microsoft.com/stocktrader/ Greg has put together a Configuration framework piece. Its still in its infancy, but is going to be great for managing multiple machine wcf/config settings. channel9/wiki site has some videos (with Greg explaining) as well. <jonesst2***@googlemail.com> wrote in message Show quote news:1192632495.352182.119190@e34g2000pro.googlegroups.com... > Hi, > > That's a step in the right direction. > > Ideally I want to keep the <service>, <serviceBehaviors> ... etc in a > service specific > configuration file, eg ServiceA.dll is entirely configured by > ServiceA.config. > > I'm wondering if my self-hosting parent application could > programmatically > change configSource="ServiceX.config" before instantiating the > specific > service X. > > I'll have to investigate. > > Thanks. > > On 17 Oct, 15:08, "sloan" <sl***@ipass.net> wrote: >> You talking about something like this?? >> >> <?xml version = "1.0" encoding = "utf-8" ?> >> <configuration> >> >> <configSections> >> <section name="dataConfiguration" >> type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, >> Microsoft.Practices.EnterpriseLibrary.Data"/> >> </configSections> >> >> <appSettings file="CustomAppSettings.config" > >> </appSettings> >> >> <connectionStrings configSource="ExternalConnectionStrings.config" /> >> >> <dataConfiguration defaultDatabase="MainDatabaseConnectionString"/> >> >> <system.serviceModel> >> >> <behaviors configSource="WCFBehaviors.config"> >> </behaviors> >> >> <bindings configSource="WCFBindings.config"> >> </bindings> >> >> <client configSource="WCFClient.config" > >> </client> >> >> <services configSource="WCFServices.config" > >> </services> >> >> </system.serviceModel> >> >> <system.diagnostics configSource="SystemDiagnostics.config"> >> </system.diagnostics> >> >> </configuration> >> >> "bindings configSource" and "system.serviceModel" >> and I think you'll find the same URL I did about it. >> >> <jonesst2***@googlemail.com> wrote in message >> >> news:1192628051.255390.151900@t8g2000prg.googlegroups.com... >> >> > Hi, >> >> > I have several ServiceHost instances each implemented in its own DLL. >> > The services are being self-hosted by a forms application. >> >> > I'd like to split the ServiceHost configuration parameters that are >> > all currently held in App.config into separate files so allowing the >> > service configurations to be managed more easily. >> >> > The only way I can see to do this is to subclass ServiceHost and >> > implement my own XML based configuration sub-system but this seems >> > insane. >> >> > Does anyone know an easy way to do this? >> >> > Thanks, Steve. > |
|||||||||||||||||||||||