c# - Hosting a WCF service in a windows service - configuration, debugging -
situation:
i have solution 3 projects:
- project 1: type wcf service
- project 2: type console application (hosts project 1)
- project 3: type console application (calls methods of wcf service, has service reference project 1)
right debugging run project 2 executable administrator, opens service. run project 3 executable call methods of wcf service.
question 1: install service windows service available, meaning when want test/use methods of service can. how instlal wcf service windows service?
question 2: wcf service has console.writeline statements display results of method calls. because service hosted in project 2 console.writelines write stuff project 2 executable. happen writelines when wcf service inside windows service?
question 3: wcf service gets config values app.config using system.configuration.configurationmanager.appsettings - windows service still have access app.config? if how resolve where/which app.config use?
question 4: how debug wcf service hosted in windows service?
- you don't install wcf services windows services directly. you'll either need host service in web server (like iis) or install service host (project 2) service.
- the output discarded (see this related question). if need retain output implement log library log4net or nlog.
- the windows service still have access app.config , follows same config location semantics console application. see this related question more information config lives.
- to debug windows service, can use "attach process" feature built visual studio. see the msdn page more information.
Comments
Post a Comment