473,788 Members | 2,719 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Windows Service Logging

Hello,

I have a Windows Service which executes some code each 2 seconds.

Every 2 seconds I want to log the result in a Windows Forms application.
What is the best approach? I think it is .NET remoting, but when the
"client" application is not started, no logging has to be done. So the
service has to know if there is a client application to log to. How can I do
that? Any suggestions?

Thanks!

Ron
Nov 21 '05 #1
1 1543
Ron,
You can use .NET Remoting: the Windows Service would have a single remoting
object that raises an Event.

The Windows Forms app would handle this event (remotely) when it is running.

The Service would simply raise the event, it doesn't care if there is any
one is handling the event or not.

In fact multiple Forms apps could handle the event, and they would all be
notified!

Matthew MacDonald's book "Microsoft Visual Basic .NET Programmer's
Cookbook" from MS Press has a topic on "Fire an Event over a Remoting
Channel" that shows how, plus information on how to enable 1.1 to work.

Alternatively you use Message Queuing (MSMQ) via the System.Messagin g
namespace to send out messages, in this case I would have the message expire
in 2 minutes, not persist it, nor send it to the dead-letter queue, as the
message is simply notifying the client...

Hope this helps
Jay

"Ron Bremmers" <r.********@hom e.nl> wrote in message
news:cv******** **@news6.zwoll1 .ov.home.nl...
Hello,

I have a Windows Service which executes some code each 2 seconds.

Every 2 seconds I want to log the result in a Windows Forms application.
What is the best approach? I think it is .NET remoting, but when the
"client" application is not started, no logging has to be done. So the
service has to know if there is a client application to log to. How can I
do
that? Any suggestions?

Thanks!

Ron

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1184
by: Todd Bright | last post by:
Does anyone know of a reason that a Windows service written in C# would prevent the system from rebooting or logging off? The service starts another thread which displays a form (processing is done in the form so as to not interfere with the service's thread execution). Stopping the service is the only way I've found to yield and let the system reboot or log off. I tried using the SystemEvents.SessionEnding event and that works great for...
2
1596
by: JJ | last post by:
I have written a multi-threaded Windows service. I developed it in such a way that the core logic is a separate class library from the actual service project, so I could test the .DLL in a console. In the console test app, the app will run for days on end without a problem. All necessary calls are thread safe (lock). However, when plugged into the Windows service, the darn thing simply grinds to a halt i a matter of minutes. No exceptions,...
6
2180
by: Nathan Kovac | last post by:
Yesterday afternoon I was getting the following errors in a windows service: 'DatabaseManager.DataComponent', 'Error', '3 Errors: Line: 0 - Metadata file 'ScriptingMethods.dll' could not be found Line: 0 - Metadata file 'RemoteLoader.dll' could not be found Line: 0 - Metadata file 'wwScripting.dll' could not be found' Service ran all night fine. This morning I reconnected to the process and the errors are no longer there. Only thing...
5
1575
by: OpticTygre | last post by:
What is the best way that anyone has found to capture errors inside a windows service? It's pointless to use compilation constants, as you can't "debug" a service very easily, and you can't pass in a command line arguement (can you?) to tell it to do something special like capture errors to a file while it's running. Has anyone figured out any good ways to do this type of run-time error capturing? Basically, if I were building a...
2
6542
by: Chris Dunaway | last post by:
I am attempting to use the AppDomain.UnhandledException event in a Windows Forms app and also in a Windows Service. But the event doesn't seem to be called. In a Windows Forms app, the event IS called but only if I run the app through the IDE. If run standalone (release or debug build, it doesn't matter), the event handler is never called. In the Windows Forms app, I changed it to use the Application.ThreadException event and that...
4
4707
by: Chris Curvey | last post by:
Hi all, I have used the win32com libraries to set up a service called MyService under Windows. So far, so good. Now I need to run multiple copies of the service on the same machine. I also have that working. For monitoring and logging, I'd like each instance of the service to know it's own identity (MyService1, MyService2, etc.) But I can't quite seem to grasp how to do this. In the code below, the command line parameter "-i"...
0
2699
by: =?Utf-8?B?U2ltb25EZXY=?= | last post by:
Hi All I would like to install the same Windows Service project on the same server under different names, one for each customer. I have been able to do it but I would like an expert opinion as to whether my solution is robust or whether there is a better way to do it. What I've been trying to do is to create a core project with different extension projects, one for each customer. I wanted to create a different Setup project for each...
2
1266
by: christery | last post by:
Jippie, got my first c# service working with XP/W2003srv (love google), but got an hunch that vista will not support services that uses GUI (can interact with desktop... checkbox in services gone?), yepp (solution) can have 2 programs - one service and one normal GUI, just wondering if anything else changes in the near future? sort of a sneak peak into what trouble im haeding in to... gotta convert some vb6 code soon that is like that...
4
269
by: emanuelanechei | last post by:
These days i'm creating a windows service in c# which reads some data from a file and saves it in a database. The data in the file changes every minute. I am using FileSystemWatcher object which monitors that file for LastWrite event. The problem is that after the reading of file and writing the data in the database the service quits unexpectedly. What happends? I googled but found nothing about it. Thank you in advance
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10373
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10118
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8995
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7519
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5538
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4074
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2897
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.