简体   繁体   中英

WCF as Service: Modifying app.config file

I have a WCF running as a Windows service. I deployed it to a server (after quite a bit of banging my head against the keyboard).

Last issue: When making changes to the app.config (programname.exe.config in the service directory under program files), it obviously needs to be restarted.

Problem is this -- when I make a change to the config file and try to restart the service, it gives me the "Some services stop automatically if they have no work to do, for example...". I have to completely uninstall the service, re-install again, modify the config file, and THEN start the service.

This seems incredibly tedious and unnecessary. I think I should be able to simply edit the config file and restart. Is there a known conflict or setting I should be looking out for?

Thanks! -Jason

Just introduce a custom action dll hook into it from your msi.

The code in the dll (mangling a file for example) will get executed after the files have been copied yo disk but before the setup completes, ie before any service gets started.

If it's a windows service you have to Install a fresh copy (after uninstalling previous one). I case of WCF services published over IIS you can make changes in the service build the project and then publish it. If some other application is already using your wcf services (endPoint) then no change is needed in that application and the new changed services can be consumed by new application without affection previous application.

You could try this instead.

  • Stop the service.
  • Modify the config file in development.
  • Re-deploy the project (say with Build -> Publish)
  • Start the service.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM