c# - How to customize the generic "Error 5: Access is denied" error message in Window Service created via TopShelf -


i created windows service via topshelf. however, when service run error during start(), shows dialog of "error 5: access denied".

i wondering if there way customize error in code....

topshelfexitcode exitcode = hostfactory.run(x =>         {             x.beforeinstall(applyconfigtransform);             x.addcommandlinedefinition(dataservicehost.anonymize_names, s => options.add(dataservicehost.anonymize_names, s));             x.addcommandlinedefinition(dataservicehost.port_override, s => options.add(dataservicehost.port_override, s));             x.service<dataservicehost>(s =>             {                 s.constructusing(name => new dataservicehost());                 s.whenstarted(host => host.start(options));                 s.whenstopped(host => host.stop());                 s.whenshutdown(host => host.logevent("shutdown"));                 s.whenpaused(host => host.logevent("paused"));                 s.whencontinued(host => host.logevent("continued"));                 s.whensessionchanged((host, scargs) => host.logsessionchanged(scargs));             });             x.setservicename("service name");             x.setdisplayname("service name");             x.setdescription("service desc");              x.enableservicerecovery(rc =>             {                 rc.restartservice(1); // restart service after 1 minute                 rc.setresetperiod(1); // set reset interval 1 day             });              x.runaslocalsystem();         }); 


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -