开发者

WCF in Windows Service. How do I change the endpoint address (PORT) using app.config and apply an updated data to wcf in windows service?

开发者 https://www.devze.com 2023-01-12 20:53 出处:网络
I\'d developed a WCF Service using netTCPBinding and embedded it in a Windows Service. The configuration data of wcf is located in standart app.config file.

I'd developed a WCF Service using netTCPBinding and embedded it in a Windows Service.

The configuration data of wcf is located in standart 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 restarted 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 previous PORT. As I've understood, it continued working using the copy of starting version of app.config. It stores 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 sol开发者_如何转开发ution of my problem?

Thank you for your help.


At the risk of stating the obvious... How literally do you mean that you changed a file called app.config? Do you mean that you changed the file called [exename].exe.config? 'Coz if you changed a file called "app.config" in the installed-to folder, that file won't have any effect. You need to make the change in the file called [exename].exe.config. --Shawn.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号