views:

31

answers:

1

I wrote one windows service locally..Now i will going to deploy it on server...My requirement is that i want to write start & stop timing of service on my local machine. so i did that locally when my service is on my local machine.. But when it will get deployed on server so how will i write that start & end time to that text file which is on my local machine...?

+1  A: 

If I'm correct in interpreting your question, then you're deploying the service to MachineA and your PC is MachineB. You want to have the service running on MachineA write to a log file on MachineB?

If this is the case, it's a simple matter to create a share on MachineB and have the service write to a file on that share, rather than a local file. So, rather than writing to C:\Log\MyLogFile.log, have the service write to \\MachineB\Log\MyLogFile.log.

One thing to consider is the fact that this means that your service won't be able to log unless your PC is running. You'll need to ensure that your code fails gracefully if this occurs, rather than hanging or crashing.

Rob