VS 2005 / .NET 2.0.50727 (Sept. CTP)
I've got a Windows Service application that I've pushed out to a few
other workstations. There is an unhandled except occurring somewhere
in the application at some point, but I can't debug it because the
diagnostic info written to the event log is nearly worthless. Here's
what I am getting:
EventType clr20r3, P1 myservice.exe, P2 0.7.0.19863, P3 435a627e, P4
myservice, P5 0.7.0.19859, P6 435a6276, P7 325, P8 42, P9
system.nullrefe renceexception, P10 NIL.
How can I get more verbose diagnostics in the event log, including the
stack trace?
TIA 8 5791
how about you add LOGGING to your application and LOG information that is
important...
"SDS" <ss*******@gmai l.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. . VS 2005 / .NET 2.0.50727 (Sept. CTP)
I've got a Windows Service application that I've pushed out to a few other workstations. There is an unhandled except occurring somewhere in the application at some point, but I can't debug it because the diagnostic info written to the event log is nearly worthless. Here's what I am getting:
EventType clr20r3, P1 myservice.exe, P2 0.7.0.19863, P3 435a627e, P4 myservice, P5 0.7.0.19859, P6 435a6276, P7 325, P8 42, P9 system.nullrefe renceexception, P10 NIL.
How can I get more verbose diagnostics in the event log, including the stack trace?
TIA
How about staying on topic?
He is. Services in .NET do not automatically log exceptions when they
are thrown. It's just not there.
You need to write it yourself. To that end, the ServiceBase class
assists you by providing an EventLog property where the log is set to the
application log, and the source is set to what is returned by the
ServiceName property.
You can write up a few try/catch blocks, and then write the exception to
the event log, and it should give you the information you want.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"SDS" <ss*******@gmai l.com> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. . How about staying on topic?
Thanks for the useful response, Nicholas. I wish all replies in
newsgroups could be as helpful as yours, but then again it's clear you
know what you are talking about.
Admittedly, I am being lazy at this point mostly due to the amount of
code, threading, and the fact that my service is in another AppDomain
from where the exception is occurring. It's just going to take me
forever to get all of the handling in place. That and I could've sworn
that .NET will write out stack trace debug info to the event log for
unhandled exceptions...
I wish there was a Service.Error global event handler simliar to
ASP.NET's... =(
I'm kind of confused by the following statement:
and the fact that my service is in another AppDomain from where the
exception is occurring
Are you saying that you are creating another app domain in your service,
and the exception is happening there? If this is the case, then the app
domain is still in the boundary of your service (or at least the CLR that is
loaded in the process of your service). All you have to do is marshal the
instance of the service to your new app domain, and you can log the events
in the event log from the new app domain.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"SDS" <ss*******@gmai l.com> wrote in message
news:11******** *************@g 47g2000cwa.goog legroups.com... Thanks for the useful response, Nicholas. I wish all replies in newsgroups could be as helpful as yours, but then again it's clear you know what you are talking about.
Admittedly, I am being lazy at this point mostly due to the amount of code, threading, and the fact that my service is in another AppDomain from where the exception is occurring. It's just going to take me forever to get all of the handling in place. That and I could've sworn that .NET will write out stack trace debug info to the event log for unhandled exceptions...
I wish there was a Service.Error global event handler simliar to ASP.NET's... =(
Yeah, you are totally correct there (except I don't think you can
marshal ServiceBase, but I do already have a class that is marshaled
for the purpose of connecting the domains), it's just one more thing to
deal with in the process of trying to track down one bug in a very
short period of time.
Always in a big damn hurry. Know what I mean?
SDS,
Why not? ServiceBase derives from Component, which derives from
MarshalByRefObj ect, which means that you can marshal a reference into the
new app domain, and then have it call back into the app domain the service
started in.
However, this can have performance ramifications. You might be better
off having an event of some sort be fired, or making a call to your
ServiceBase-derived class on a method you define, which will indicate what
happens, and then you can do the work in the app domain of your service.
Oh, EventLog derives from Component as well, so you can marshal that by
reference across the app domain boundary as well.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"SDS" <ss*******@gmai l.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. . Yeah, you are totally correct there (except I don't think you can marshal ServiceBase, but I do already have a class that is marshaled for the purpose of connecting the domains), it's just one more thing to deal with in the process of trying to track down one bug in a very short period of time.
Always in a big damn hurry. Know what I mean?
I'm not sure, maybe you can, but at some point I made the decision to
not marshal the ServiceBase across AppDomains. Anyhow, like I said, I
have a class whose purpose is nothing other than to act as the
connector between domains, and it is this object that is marshaled.
I've added an EventLog member to this class and am now in the process
of setting up exception handling. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Simon Harvey |
last post by:
Hi,
Does anyone know of the top of their head, how I would add an entry to the
event logs in XP/2000 machines?
Thanks all
Simon
|
by: Dhilip Kumar |
last post by:
Hi All,
I'm writing a Windows Service app using C#. I need to read some
configuration settings before the service starts up. These settings will be
used by the service in its operation. Question is, which is the best way to
store & retrieve the settings? I'm thinking of storing it in the registry
in HKLM\Software\ServiceName and access it using the Registry class in the
"public ServiceName()" method. I'm instructing the service...
|
by: Patrick |
last post by:
I have the following code, which regardless which works fine and logs to the
EventViewer regardless of whether
<processModel/> section of machine.config is set to username="SYSTEM" or
"machine"
---Start of test.aspx----
<%@ Page language="C#" AutoEventWireup="false" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
|
by: Kristof Despiere |
last post by:
Suppose you have one domain, filled with a couple of users. What needs to be
done now is I need to start a windows application from a webform by pressing
a button on the webform (for example).
The problem is that the user who "owns" the service is always the ASPNET
account. That's not good since you don't see the actual application (because
it's owned by ASPNET). I've tried changed the processmodel section in the
machine.config file to...
|
by: Aaron Hackney |
last post by:
Hello. I am writing a service that I would like to have write access to
the Application event log. Since the service is running as a system
account, it would appear that I do not have access. (Security Error).
I am following the MSDN howto and it does not appear to have any
additional requirements in their howto.
If I run this as an application under my credentials (local admin) it
runs just fine.
| |
by: Guy Noir |
last post by:
Hello.
OK, Thanks to the help I have the remote debugging worked out.
Here is my next hurdle.
I have a service that is supposed to be catching Event Log written
events.
this.eventLog1.EntryWritten += new
System.Diagnostics.EntryWrittenEventHandler(this.eventLog1_EntryWritten);
|
by: clsmith66 |
last post by:
I hope this is just something stupid I'm missing and someone can easily point
out my error. I'm trying to do a few turorials on windows services, and the
couple I found so far just create an event log and write an entry on start
and stop. I build the projects and install them fine, but when I run the
service it starts and stops instantly. The service is not creating the
custom event log I wanted it to but instead adds an error message in...
|
by: JeffDotNet |
last post by:
Writing to a registered source in the Application event log
I have an asp.net framework 2.0 app that I created on a winxp machine and
now I am deploying it to IIS6 on a win server2003 machine. This application
has to write to the application event log.
After deployment of the application I have verified that my source
“MySource” exists in the Application event log. I then wrote some text to
the event source in a forms app and...
|
by: chitra g |
last post by:
Hi,
I tried all the options below but did not work.
Your suggestions please.
|
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...
|
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,...
| |
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |