windows-services

Specify directory for Serilog rolling file path

北战南征 提交于 2019-12-01 05:04:40
问题 Consider this app.config appSetting entry: <add key="serilog:write-to:RollingFile.pathFormat" value="ServerServiceApp-{Date}.log" /> This is done at app startup: Log.Logger = new LoggerConfiguration() .ReadFrom.AppSettings() .Enrich.WithThreadId() .CreateLogger(); This is in a Windows service app. The log file ends up here: C:\Windows\SysWOW64 Clearly, we’d rather have the log file end up in the same directory that houses this service’s .exe (customers don’t want us writing stuff to SysWOW64)

What are the security risks in running a Windows Service as “Local System”?

一世执手 提交于 2019-12-01 04:07:45
I have written a .NET Windows service which runs as "Local System". Recently I read that, running as local system might expose system credential to hackers enabling them to take over the system. What are the risks involved and how can I prevent them when I run service as Local System. Services running as LocalSystem are part of the system's trusted space. Technically speaking, they have the SeTcbName privilege. This means, inter alia , that such services can alter any security settings, grant themselves any privileges, and generally do anything Windows can do. As a result, any flaw in your

Find status of Windows service from Java application?

倾然丶 夕夏残阳落幕 提交于 2019-12-01 03:56:54
问题 How to check the status of the windows services from a java program? 回答1: on the following example you can find how can you check windws service status and you can parsed to do certain action import java.util.*; import java.sql.*; import java.io.*; import java.text.*; public class doscmd { public static void main(String args[]) { try { Process p=Runtime.getRuntime().exec("sc query browser"); BufferedReader reader=new BufferedReader(new InputStreamReader(p.getInputStream())); String line

Running Windows Service Application without installing it

。_饼干妹妹 提交于 2019-12-01 03:30:01
Whem I'm writing a Windows Service and just hit F5 I get the error message that I have to install it using installutil.exe and then run it. In practice this means everytime I change a line of code: compile switch to Developer Command Prompt remove old version install new version start service That is very inconvenient. Is there a better way to do it? I usually put the bulk of the service implementation into a class library, and then create two "front-ends" for running it - one a service project, the other a console or windows forms application. I use the console/forms application for debugging

Writing windows service in .net core

末鹿安然 提交于 2019-12-01 03:19:08
问题 My question is How can I write the windows service in .net core which we used to write in prior .net versions ? Lots of links/articles explain how to host your .net core application as windows service. So this is the only way I can create windows service ? If yes, can anyone please provide the links/example of it Thanks ! 回答1: Not sure if there is a default way of doing this. You can however let your core application inherit from ServiceBase and implement the necessary overrides. We do this

Cannot access excel file

烂漫一生 提交于 2019-12-01 03:16:07
I'm developing a windows service, generating a report. This report has a template. This template is prepared in an excel file. This file is copied to the output folder. While developing I launched the service like a console application and had no problems accessing this file. Then I prepared a service installer. The service is installed under Local System account. So this excel template file is marked as content and copied to the installation directory together with the executable as well. But when the service is launched excel appears to have no access to this file. The service is installed

Access denied using Py2exe

旧时模样 提交于 2019-12-01 03:10:18
I'm using Py2exe to create an executable as a windows service. When I run the script I get this error: File "C:\TeamCity\buildAgent\work\582d895bd5b431ac\winpython\WinPython-32bit-2.7.3.3\python-2.7.3\lib\site-packages\py2exe\build_exe.py", line 860, in build_executable add_resource(ensure_unicode(exe_path), script_bytes, u"PYTHONSCRIPT", 1, True) RuntimeError: EndUpdateResource: Access is denied. This is the call to py2exe: setup( name = NAME, description = DESCRIPTION, version = '1.0.133.43', service = [{'modules':["ServiceLauncher"], 'cmdline':'pywin32'}], zipfile=None, options = { "py2exe"

Can't install Tomcat 7 as a Service in Windows

徘徊边缘 提交于 2019-12-01 00:17:18
I'm trying to install tomcat as a service in Windows Server 2008. I searched in stackoverflow and can't find any answer to this problem, i can see other related questions which all of them are not the same ( are related to code error 0, mine is code error 1 ) or have not valid answers, so i decided to create this question. I'm using this to create the service: https://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html#Installing_services tomcat7 //IS//Tomcat7 --DisplayName="Apache Tomcat 7" \ After the command, i can see in my Services list the Apache Tomcat 7 service, the problem is

How to retain service settings through InstallShield upgrade install

爷,独闯天下 提交于 2019-12-01 00:12:08
I have an InstallScript project in IS2010. It has a handful of services that get installed. Some are C++ exes and use the "InstallShield Object for NT Services". Others are Java apps installed as services with Java Service Wrapper through LaunchAppAndWait command line calls. Tomcat is also being installed as a service through a call to its service.bat. When the installer runs in upgrade mode, the services are reinstalled, and the settings (auto vs. manual startup, restart on fail, log-on account, etc.) are reverted to the defaults. I would like to save the service settings before the file

C# Windows service needs to make registry changes

筅森魡賤 提交于 2019-12-01 00:05:08
I have a service that needs to update the registry every 5 minutes (counteract gpo). The code runs fine in a regular application, but when I put it in a windows service, it doesn't make the changes. I am using the local system account for the service and it is not throwing any exceptions The code below works in a regular console app but not in the service: RegistryKey key = Registry.CurrentUser.OpenSubKey("Control Panel\\Desktop", true); if (key != null) { key.SetValue("ScreenSaverIsSecure", "0", RegistryValueKind.String); key.SetValue("ScreenSaveActive", "0", RegistryValueKind.String); key