473,804 Members | 3,380 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 7960
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.*********@ue a.ac.uk> wrote in message
news:#F******** ******@TK2MSFTN GP11.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**********@y ahoo.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: ApplicationActi vation(Activati onOption.Librar y)]

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

[assembly: ApplicationActi vation(Activati onOption.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: ApplicationActi vationAttribute
Class
http://msdn.microsoft.com/library/de...classtopic.asp

..NET Framework Class Library: ActivationOptio n 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
13519
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, however, I get the following message on the browser shown below in bold text: Security Exception Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required...
1
3086
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 Event ID ( 0 ) in Source ( Application ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this...
2
4368
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 logging. It must be simple to enable the detailed output in the live application. I have used Debug.Write() but this seems to come out only on the output window in the IDE - is there a way of configuring this to go into a file? I also saw there is...
18
4897
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) p.stdin.write("hostname\n") however, it doesn't seem to work. I think the cmd.exe is catching it.
4
7290
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 file being created, it will be sent out via email to the list of recipients. I run the script on my notebook (also developed on th same machine) it works fine. However, when I copy all the programs into the server which running on Windows 2000...
0
1510
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 Application log file: ------------------------------------------------------------------------------------------------------ Event ID :17055
3
18506
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 Application log file: ---------------------------------------------------------------------------­---------------------------
2
1264
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 info. thanks,
16
1469
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 previous file finished writing so I can skip writing at that time? I write using the Bitmap.Save method.
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10575
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...
0
10330
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10319
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
10076
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
9144
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...
0
6851
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();...
0
5520
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...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.