Re: setting a connection string for a Windows Service on productio by wmild
wmild
Tue May 06 09:26:01 CDT 2008
Thanks Norman. You basically told me that when I stop and restart the
service, it should re-read the app.config at that point. That is what I
would have expected. There must be something deeper going on. Due to time
constraints, I've opened a case with Microsoft to get this figured out.
Thanks Again,
Bill
"Norman Yuan" wrote:
> It depends on how the WIN Service app reads the connectionString from
> app.config. If you let the service read app.config at startup only, then you
> need to stop and restart the service once the app.config is changed. This is
> the common approach. As the developer of the Service, you do know when the
> service app reads the settings in app.config, don't you? The best thing to
> do is to make sure the ConnectioNString is correct before installing the Win
> service in a production box.
>
> If for some reasons that your service can never be stopped once started,
> then you could code the service to read the ConnectionString setting in
> app.config periodically to see if change has been made, if yes, use the
> newly read ConnectionString. However, I doubt its necessity, although it is
> technically doable.
>
>
> "Bill Mild" <wmild@community.nospam> wrote in message
> news:33F2ED98-0CD4-40F0-AA23-659B4F351FCA@microsoft.com...
> > Feel free to let me know if there is a better place to post this question
> >
> > I'm a website developer trying to write a Windows Service, and I think I'm
> > running into trouble due to the paradigm shift.
> >
> > In website development, I change the web.config file on the fly without
> > re-building a project. How does this work with the app.config in a
> > Windows
> > Service? It seems like when I update a ConnectionString in app.config
> > after
> > rolling to a production server, it doesn't take. Does app.config get
> > complied into the executable on build so that I can't change it on the
> > fly?
> > If so, how would I set it up to be able to configure the db connection
> > string
> > on the production server?
> >
> > Thanks.
>
>