windows-services

Printing from a .NET Service [closed]

老子叫甜甜 提交于 2019-11-27 01:35:31
I am working on a project right now that involves receiving a message from another application, formatting the contents of that message, and sending it to a printer. The technology of choice is C# windows service. The output could be called a report, I suppose, but a reporting engine is not necessary. A simple templating engine, like StringTemplate, or even XSLT outputting HTML would be fine. The problem I'm having is finding a free way to print this kind of output from a service. Since it seems that it will work, I'm working on a prototype using Microsoft's RDLC, populating a local report and

How can I mount a windows drive in Java?

扶醉桌前 提交于 2019-11-27 01:29:30
We are working with some legacy code that accesses a shared drive by the letter (f:\ for example). Using the UNC notation is not an option. Our Java wrapper app will run as a service, and as the first step, I would like to map the drive explicitly in the code. Has anyone done this? Consider executing the DOS command that maps a network drive as in the following code: String command = "c:\\windows\\system32\\net.exe use f: \\\\machine\\share /user:user password"; Process p = Runtime.getRuntime().exec(command); ... See details on net use command: The syntax of this command is: NET USE

Start a windows service and launch cmd

风流意气都作罢 提交于 2019-11-27 01:04:13
Do I need to enable Interactive desktp for it to work and what is the correct code to start an EXE or cmd window? I'm still unable to start the service even when I had enable it to interact with desktop. I would be using an chat engine so it is easier to manage as a windows service. What wrong with my code? using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ServiceProcess; using System.Diagnostics; using System.ComponentModel; using System.Threading; namespace MyNewService { class Program : ServiceBase { static void Main(string[] args) { } public

What is the best NHibernate session management approach for using in a multithread windows service application?

倖福魔咒の 提交于 2019-11-27 01:02:45
问题 I have a windows service application that work with multithread. I use NHibernate in data access layer of this application. What is your suggestion for session management in this application. I read about UNHAddins, Is it a good solution? 回答1: I use NHibernate's built in contextual sessions. You can read about them here: http://nhibernate.info/doc/nhibernate-reference/architecture.html#architecture-current-session Here is an example of how I use this: public class SessionFactory { protected

Best way to do a task looping in Windows Service

时光怂恿深爱的人放手 提交于 2019-11-27 01:02:19
问题 I have a method that send some SMS to our customers that look like below: public void ProccessSmsQueue() { SmsDbContext context = new SmsDbContext(); ISmsProvider provider = new ZenviaProvider(); SmsManager manager = new SmsManager(context, provider); try { manager.ProcessQueue(); } catch (Exception ex) { EventLog.WriteEntry(ex.Message, EventLogEntryType.Error); } finally { context.Dispose(); } } protected override void OnStart(string[] args) { Task.Factory.StartNew(DoWork).ContinueWith( ???

Mongodb, sharding and multiple windows services

做~自己de王妃 提交于 2019-11-27 00:58:39
问题 In order to get sharding to work I need to run two copies of mongod.exe. One as a shard and one as the config server. How can I install both mongod instances as windows services? 回答1: The following command line will install a 2nd instance of Mongo DB. Note that you have to provide serviceName , serviceDisplayName , port , dbpath and logpath in order to avoid collisions. mongod --install --serviceName " Mongo DB 2nd instance " --serviceDisplayName " Mongo DB 2nd instance " --port 37017 -

Can't start Windows service written in Python (win32serviceutil)

南楼画角 提交于 2019-11-27 00:57:15
问题 I'm trying to start a simple service example: someservice.py: import win32serviceutil import win32service import win32event class SmallestPythonService(win32serviceutil.ServiceFramework): _svc_name_ = "SmallestPythonService" _svc_display_name_ = "display service" def __init__(self, args): win32serviceutil.ServiceFramework.__init__(self, args) self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) def SvcStop(self): self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) win32event

How to monitor Windows services [closed]

自古美人都是妖i 提交于 2019-11-27 00:51:41
问题 I'm looking for a way to monitor certain Windows services (on Windows Server 2003) and restart if necessar y. The services are on different servers and include mainly SQL Server services (e.g. SQL Server Agent), but also some proprietary services. Email alerts sent out if a service has stopped would be very useful as well. 回答1: A "might be enough" version of this is built into Windows. Look into the "Recovery" tab of the service properties, as available via services.msc . You can act on a

Install windows service without InstallUtil.exe

点点圈 提交于 2019-11-27 00:48:05
问题 I'm trying to deploy a windows service but not quite sure how to do it right. I built it as a console app to start with, I've now turned it into a windows service project and just call my class from the OnStart method in the service. I now need to install this on a server which doesn't have Visual Studio on it, which if I've understood it correctly means I can't use the InstallUtil.exe and have to create an installer class instead. Is this correct? I did have a look at a previous question,

Minimum rights required to run a windows service as a domain account [closed]

。_饼干妹妹 提交于 2019-11-27 00:47:47
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . Does anyone know what would be the minimum rights I would need to grant to a domain user account in order to run a windows service as that user? For simplicity, assume that the service does nothing over and above starting, stopping, and writing to the "Application" event log - i.e. no network access, no custom