C# app to pass data to windows service -


i have written windows service, handles updating of files server on daily basis.

i have simple c# app, have following options:

install/uninstall service start/stop service

and 2 textboxes login button.

my idea is, on login button click, if service running stop it, pass login info in onstart method, start , let service work (reestablish connection server , on).

my question is, there easy way pass login info textboxes onstart method via it's args[], button click? searched solution, suggest running service command line parameters, , need operated app entirely.

i found article named pipes, have troble understanding it. also, service need not other parameters pass, 2 strings textboxes.

edit: will

servicecontroller sc = new servicecontroller("servicename", environment.machinename); string[] args = new string[2]; args[0] = txtbox1.text; args[1] = txtbox2.text;  sc.start(args); 

do trick?

you cannot use string[0] etc work:

servicecontroller sc = new servicecontroller("servicename", environment.machinename); string[] args = new string[2]; args[0] = txtbox1.text; args[1] = txtbox2.text;  sc.start(args); 

you need administrator privileges start service way.

i don't know goal of project i'd recommend checking out service proerpties (running services.msc on command prompt). if view properties, can pass parameters using start parameters field. can run service under credentials want using log on tab in case these may suit needs.


Comments

  1. Blackjack Casino, Hotel & Spa (Bridgewater, MS) - Mapyro
    Blackjack Casino Hotel & 삼척 출장마사지 Spa (Bridgewater, MS). 0.4 mi (0.5 km) from 보령 출장안마 Blackjack Casino, Hotel & Spa. 2.6 mi (0.5 km) from Bidsafe Casino. 구미 출장마사지 0.3 군산 출장샵 mi (0.4 km) from Bidsafe Casino. 0.2 mi (0.3 수원 출장마사지 km

    ReplyDelete

Post a Comment