473,503 Members | 2,720 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Write to IIS/Event Log File ?

Hi y'all,

recently I've come across a situation where a web service needs to deal
with an exception that might arise, originating from a COM+ component. It
then returns an int value (please don't ask me why) indicating that there
was something wrong with the requested operation.

Assuming that I don't really know all the posible exceptions that might
arise from the COM+ layer, and therefore I can't accurately return an int
identifying the exception, I need a way to log the actual exception trace,
either in the web service, or in the COM+ layer.

Writting to the event log threw me Security Exceptions, because ASPNET
doesn't have write access to the event log. Since the COM+ level runs under
the same identity apparently, I can't do it there either ..

So, question: how can I log either into the IIS Log, or the Event log from a
web service ?

Cheers,
Angel
O:]
Jul 21 '05 #1
3 7929
Angelos Karantzalis wrote:
So, question: how can I log either into the IIS Log, or the Event log
from a web service ?


Is this is error you're getting?
http://support.microsoft.com/default...b;en-us;329291
Jul 21 '05 #2
YES ! Thanks a lot Leon

O:]

"Leon Mayne [MVP]" <l.*********@uea.ac.uk> wrote in message
news:#F**************@TK2MSFTNGP11.phx.gbl...
Angelos Karantzalis wrote:
So, question: how can I log either into the IIS Log, or the Event log
from a web service ?


Is this is error you're getting?
http://support.microsoft.com/default...b;en-us;329291

Jul 21 '05 #3
"Angelos Karantzalis" <ak**********@yahoo.com> wrote:
Hi y'all,

recently I've come across a situation where a web service needs to deal
with an exception that might arise, originating from a COM+ component. It
then returns an int value (please don't ask me why) indicating that there
was something wrong with the requested operation.

Assuming that I don't really know all the posible exceptions that might
arise from the COM+ layer, and therefore I can't accurately return an int
identifying the exception, I need a way to log the actual exception trace,
either in the web service, or in the COM+ layer.

Writting to the event log threw me Security Exceptions, because ASPNET
doesn't have write access to the event log.
ASP.NET should have rights to WRITE to the application event
log - however it does not have right to create a new Event
Source:

PRB: "Requested Registry Access Is Not Allowed" Error
Message When ASP.NET Application Tries to Write New
EventSource in the EventLog
http://support.microsoft.com/default...b;en-us;329291

Little examples like

How To Write to an Event Log by Using Visual C# .NET
http://support.microsoft.com/default...b;en-us;307024

fail to mention this fact.

For a more thorough treatment of event logging see

Visual Basic and Visual C# Concepts: Walkthrough: Installing
an Event Log Component
http://msdn.microsoft.com/library/de...installers.asp

In essence it is your project's installer's responsibilty to
create the event source when the application/component is
installed - and it should also delete it when the
application/component is removed.
Since the COM+ level runs under
the same identity apparently, I can't do it there either ..
Well you can fix that. If the Enterprise Component specifies

[assembly: ApplicationActivation(ActivationOption.Library)]

then you have no choice and will be running in the caller's
security context. If you specify

[assembly: ApplicationActivation(ActivationOption.Server)]

then you can configure a dedicated account for the Server
through Component Services Properties ("Identity" Tab) -
this in fact is the tactic to use to perform actions that
requires elevated privileges that ASP.NET has no business
having. Note that the Server must reside in the GAC.

..NET Framework Developer's Guide: Registering Serviced
Components
http://msdn.microsoft.com/library/de...components.asp

NET Framework Class Library: ApplicationActivationAttribute
Class
http://msdn.microsoft.com/library/de...classtopic.asp

..NET Framework Class Library: ActivationOption Enumeration
http://msdn.microsoft.com/library/de...classtopic.asp
So, question: how can I log either into the IIS Log, or the Event log from a
web service ?

Cheers,
Angel
O:]


Jul 21 '05 #4

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

Similar topics

2
13490
by: FrodoBaggins | last post by:
Dear Team, I am running Visual Studio 2003 Version 7.1.3088 on Windows Server 2003. I have written a C# application that must write to the event log. When it attempts to write to the event log,...
1
3066
by: DC Gringo | last post by:
I have some code that writes log entries upon errors in an VB.NET web app. I can write the Message but in the log, preceding my message is the following: Description: The description for...
2
4317
by: Andy Fish | last post by:
Hi, I am wanting to put some simple logging into my .net app. The basic features will be that errors get logged to a file and that there will be a configuration flag to enable more detailed...
18
4855
by: jas | last post by:
Hi, I would like to start a new process and be able to read/write from/to it. I have tried things like... import subprocess as sp p = sp.Popen("cmd.exe", stdout=sp.PIPE)...
4
7268
by: Seok Bee | last post by:
Dear Experts, I have created a script to extract the Event Logs from the system into an excel sheet. The logs are separated into 2 worksheets (Application Log and System Log). After this excel...
0
1499
by: sk.rasheedfarhan | last post by:
Hi all, According to my project requirement I have to write the NT Event information of SQL Server into EventLog viewer. For more clear I want to write the following information into...
3
18487
by: sk.rasheedfarhan | last post by:
Hi all, According to my project requirement I have to write the NT Event information of SQL Server into EventLog viewer. For more clear I want to write the following information into...
2
1253
by: lamarts | last post by:
Hello all, New user to python. I can write to a file, however, I would like to do both...whatever I do on the screen, I'd like to write it to a file. any pointers on where I can find this...
16
1443
by: AAaron123 | last post by:
I have a timer. At each tick, say 0.1 second, I write a file. If it takes more than 0.1 second to write the file the app will not work correctly. How can I tell in the tick event if the...
0
7063
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...
0
7258
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,...
0
7441
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...
0
5558
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,...
1
4987
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...
0
3156
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...
0
3146
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1489
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 ...
0
366
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...

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.