Using a Winforms App to Configure a Windows Service -
i have single project made of winform , windows service. when installed, both exist in same, common folder, c:\program files\
i winform able set settings such connection strings, passwords, logfile paths, etc. in common xml file both applications share. handle of encryption , decryption not issue.
the issue seems when application installed, winform unable update file , access denied error although complete domain admin absolute rights on desktop.
the question is, how 1 go allowing winform define common connection string between both winform application , windows service wishes configure?
i not want rely on machine.config , want own xml file hold of configuration options. there must simple i'm missing, simple solution?
the registry has caused nothing headaches in past since microsoft seems have moved application.config route , have started lock down registry. add entire wow6432 branching , has become more difficult use.
my current solution, seems working well, have following function point same location whether called service or winform long both have same company name , product name. place own xml config file in location , in world.
' ********************************************************************************************************** ' returns commong data folder ' if folder not exist, attempts create ' ********************************************************************************************************** public function getcommondatafolder(byref errormessage string) string dim result string = "" result = environment.getfolderpath(environment.specialfolder.commonapplicationdata) & "\" & my.application.info.companyname & "\" & my.application.info.productname try directory.createdirectory(result) catch ex exception errormessage = "an exception occurred creating directory: " & result & ": " & ex.message end try return result end function
Comments
Post a Comment