WCF in Windows Service. How do I change the endpoint address using app.config and apply an updated data to wcf in windows service?
Posted on 2010-08-24
I'd developed a WCF Service using netTCPBinding and embedded it in a Windows Service.
The configuration data of wcf is located in app.config file.
After that i had created an installation project and include my code (wcf in widows service) there. So I have the setup.exe file to install my windows service with wcf on board.
I've installed the windows service to my local drive (C:\Programs Files\...\Service) and started it using the services page (pane) of my OS.
It works fine.
The app.config file was copied to the local drive and located across the same folder (C:\Programs Files\...\Service).
One day i've tried to change the part of my endpoint address (PORT) in app.config (C:\Program Files\...\app.config) and resterted the service using an appropriate page of services (services.msc) in windows.
I thought that the service would be working on another port (I've setted in app.config) but i was wrong. The service continued working on the past PORT. As I've understood, it continued working using the copy of starting version of app.config. It store the copy of this file in another path.
I need the ability to change the app.config file and get the updated windows service after it's restarting.
I am going to let my users set the specified port number where the developed wcf service will listening to.
Where am I wrong? Could you help me to find the solution of my problem?
Thank you for your help.