473,799 Members | 3,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unable to Write to Event Log w/ Enterprise Library 2.0 in Win App

Hi,

Thanks in advance for reading this.

Not sure where to post this question, but I hope someone in here can help.

Trying to write to Event Log in VS 2005 (.NET 2.0) using Enterprise Library
2.0
on a XP Pro SP2 Machine

Setup a basic Windows app in Form load's:
Imports Microsoft.Pract ices.Enterprise Library.Excepti onHandling
Imports Microsoft.Pract ices.Enterprise Library.Logging
Imports Microsoft.Pract ices.Enterprise Library.Common

Public Class Form1

Private Sub Form1_Load(ByVa l sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
Try
Logger.Write("W riting to EventLog", "Sample Exception", 0, 100,
TraceEventType. Information, "Sample Title")

Process()
Catch ex As Exception
ExceptionPolicy .HandleExceptio n(ex, "Sample Exception Policy")
End Try

End Sub

' Routine that causes an exception to be thrown
Private Sub Process()
Throw New Exception("Orig inal Generated Exception")
End Sub

End Class

-----------------------------------------------------------------------------------

Here's how it looks like with the Enterprise Lib Config tool for the
Execption and Logging blocks:
Exception Handling Application Block
Sample Exception Policy
Name: Sample Exception Policy
Exception
PostHandlingAct ion: NotifyRethrow
Logging Handler
EVentID: 100
FormaterType:
Microsoft.Pract ices.Enterprise Library.Excepti onHandling.Text ExceptionFormat ter
LogCategory: Sample Exception
Name: Logging Handler
Priority: 0
Severity: Error
Title: Enterprise Library Exception Handling - Sample App
Logging Application Block
Filter
Category Sources
Sample Exception
SourceLevels: All
Formatted Eventlog TraceListener
ReferencedTrace Listener: Formattted EVenlog TraceListener

Special Sources
Logging Errors & Warnings
SourceLevels: All
Formatted Eventlog TraceListener
ReferencedTrace Listener: Formattted EVenlog TraceListener
Unprocessed Category
SourceLevels: All
All Events
SourceLevels: All
Trace Listeners
Formatted EVentlog TraceListener
Formatter: TExt Formatter
Log: Application
MachineName: MyWorkstationNa me
Name: Formatter: TExt Formatter
Source: Enterprise Library Logging - Sample App
TraceOutputOpti ons: None

-----------------------------------------------------------------------------------

Able to write to the Event log with the write method of the logger class.
But when the exception is thrown, the error below appears.

-----------------------------------------------------------------------------------
System.Configur ation.Configura tionErrorsExcep tion was unhandled
BareMessage="Th e type
Microsoft.Pract ices.Enterprise Library.Excepti onHandling.Logg ing.LoggingExce ptionHandler,
Microsoft.Pract ices.Enterprise Library.Excepti onHandling.Logg ing,
Version=2.0.0.0 , Culture=neutral , PublicKeyToken= 123456789012345 b from
configuration could not be created."
Filename="C:\Vi sual Studio 2005\Projects\W indows
Desktop\Windows Application1\Wi ndowsApplicatio n1\bin\Debug\Wi ndowsApplicatio n1.vshost.exe.c onfig"
Line=47
Message="The type
Microsoft.Pract ices.Enterprise Library.Excepti onHandling.Logg ing.LoggingExce ptionHandler,
Microsoft.Pract ices.Enterprise Library.Excepti onHandling.Logg ing,
Version=2.0.0.0 , Culture=neutral , PublicKeyToken= 37433583d12c9c1 b from
configuration could not be created. (C:\Visual Studio 2005\Projects\W indows
Desktop\Windows Application1\Wi ndowsApplicatio n1\bin\Debug\Wi ndowsApplicatio n1.vshost.exe.c onfig line 47)"
Source="System. Configuration"
StackTrace:
at System.Configur ation.BaseConfi gurationRecord. EvaluateOne(Str ing[]
keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord,
SectionRecord sectionRecord, Object parentResult)
at
System.Configur ation.BaseConfi gurationRecord. Evaluate(Factor yRecord
factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean
getLkg, Boolean getRuntimeObjec t, Object& result, Object&
resultRuntimeOb ject)
at
System.Configur ation.BaseConfi gurationRecord. GetSectionRecur sive(String
configKey, Boolean getLkg, Boolean checkPermission , Boolean getRuntimeObjec t,
Boolean requestIsHere, Object& result, Object& resultRuntimeOb ject)
at
System.Configur ation.BaseConfi gurationRecord. GetSectionRecur sive(String
configKey, Boolean getLkg, Boolean checkPermission , Boolean getRuntimeObjec t,
Boolean requestIsHere, Object& result, Object& resultRuntimeOb ject)
at
System.Configur ation.BaseConfi gurationRecord. GetSectionRecur sive(String
configKey, Boolean getLkg, Boolean checkPermission , Boolean getRuntimeObjec t,
Boolean requestIsHere, Object& result, Object& resultRuntimeOb ject)
at System.Configur ation.BaseConfi gurationRecord. GetSection(Stri ng
configKey, Boolean getLkg, Boolean checkPermission )
at System.Configur ation.BaseConfi gurationRecord. GetSection(Stri ng
configKey)
at
System.Configur ation.ClientCon figurationSyste m.System.Config uration.Interna l.IInternalConf igSystem.GetSec tion(String sectionName)
at System.Configur ation.Configura tionManager.Get Section(String
sectionName)
at
Microsoft.Pract ices.Enterprise Library.Common. Configuration.S ystemConfigurat ionSourceImplem entation.GetSec tion(String sectionName)
at
Microsoft.Pract ices.Enterprise Library.Common. Configuration.S ystemConfigurat ionSource.GetSe ction(String sectionName)
at
Microsoft.Pract ices.Enterprise Library.Excepti onHandling.Conf iguration.Excep tionHandlingSet tings.GetExcept ionHandlingSett ings(IConfigura tionSource
configurationSo urce)
at
Microsoft.Pract ices.Enterprise Library.Excepti onHandling.Exce ptionHandlingCo nfigurationView .get_ExceptionH andlingSettings ()
at
Microsoft.Pract ices.Enterprise Library.Excepti onHandling.Exce ptionHandlingCo nfigurationView .GetExceptionPo licyData(String policyName)
at
Microsoft.Pract ices.Enterprise Library.Excepti onHandling.Exce ptionPolicyCust omFactory.GetCo nfiguration(Str ing id, IConfigurationS ource configurationSo urce)
at
Microsoft.Pract ices.Enterprise Library.Excepti onHandling.Exce ptionPolicyCust omFactory.Creat eObject(IBuilde rContext
context, String name, IConfigurationS ource configurationSo urce,
ConfigurationRe flectionCache reflectionCache )
at
Microsoft.Pract ices.Enterprise Library.Common. Configuration.O bjectBuilder.Co nfiguredObjectS trategy.BuildUp (IBuilderContex t
context, Type t, Object existing, String id)
at
Microsoft.Pract ices.ObjectBuil der.BuilderStra tegy.BuildUp(IB uilderContext
context, Type typeToBuild, Object existing, String idToBuild)
at
Microsoft.Pract ices.ObjectBuil der.SingletonSt rategy.BuildUp( IBuilderContext
context, Type typeToBuild, Object existing, String idToBuild)
at
Microsoft.Pract ices.ObjectBuil der.BuilderStra tegy.BuildUp(IB uilderContext
context, Type typeToBuild, Object existing, String idToBuild)
at
Microsoft.Pract ices.Enterprise Library.Common. Configuration.O bjectBuilder.Co nfigurationName MappingStrategy .BuildUp(IBuild erContext
context, Type t, Object existing, String id)
at
Microsoft.Pract ices.ObjectBuil der.BuilderBase `1.DoBuildUp(IR eadWriteLocator
locator, Type typeToBuild, String idToBuild, Object existing, PolicyList[]
transientPolici es)
at
Microsoft.Pract ices.ObjectBuil der.BuilderBase `1.BuildUp(IRea dWriteLocator
locator, Type typeToBuild, String idToBuild, Object existing, PolicyList[]
transientPolici es)
at
Microsoft.Pract ices.ObjectBuil der.BuilderBase `1.BuildUp[TTypeToBuild](IReadWriteLoca tor
locator, String idToBuild, Object existing, PolicyList[] transientPolici es)
at
Microsoft.Pract ices.Enterprise Library.Common. Configuration.O bjectBuilder.En terpriseLibrary Factory.BuildUp[T](IReadWriteLoca tor
locator, String id, IConfigurationS ource configurationSo urce)
at
Microsoft.Pract ices.Enterprise Library.Common. Configuration.O bjectBuilder.Lo catorNameTypeFa ctoryBase`1.Cre ate(String name)
at
Microsoft.Pract ices.Enterprise Library.Excepti onHandling.Exce ptionPolicy.Get ExceptionPolicy (Exception exception, String policyName)
at
Microsoft.Pract ices.Enterprise Library.Excepti onHandling.Exce ptionPolicy.Han dleException(Ex ception exceptionToHand le, String policyName)
at WindowsApplicat ion1.Form1.Form 1_Load(Object sender, EventArgs e)
in C:\Visual Studio 2005\Projects\W indows
Desktop\Windows Application1\Wi ndowsApplicatio n1\Form1.vb:lin e 13
at System.EventHan dler.Invoke(Obj ect sender, EventArgs e)
at System.Windows. Forms.Form.OnLo ad(EventArgs e)
at System.Windows. Forms.Form.OnCr eateControl()
at System.Windows. Forms.Control.C reateControl(Bo olean fIgnoreVisible)
at System.Windows. Forms.Control.C reateControl()
at System.Windows. Forms.Control.W mShowWindow(Mes sage& m)
at System.Windows. Forms.Control.W ndProc(Message& m)
at System.Windows. Forms.Scrollabl eControl.WndPro c(Message& m)
at System.Windows. Forms.Container Control.WndProc (Message& m)
at System.Windows. Forms.Form.WmSh owWindow(Messag e& m)
at System.Windows. Forms.Form.WndP roc(Message& m)
at
System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
at System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage& m)
at System.Windows. Forms.NativeWin dow.DebuggableC allback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows. Forms.SafeNativ eMethods.ShowWi ndow(HandleRef hWnd,
Int32 nCmdShow)
at System.Windows. Forms.Control.S etVisibleCore(B oolean value)
at System.Windows. Forms.Form.SetV isibleCore(Bool ean value)
at System.Windows. Forms.Control.s et_Visible(Bool ean value)
at
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo pInner(Int32
reason, ApplicationCont ext context)
at
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo p(Int32 reason,
ApplicationCont ext context)
at System.Windows. Forms.Applicati on.Run(Applicat ionContext context)
at
Microsoft.Visua lBasic.Applicat ionServices.Win dowsFormsApplic ationBase.OnRun ()
at
Microsoft.Visua lBasic.Applicat ionServices.Win dowsFormsApplic ationBase.DoApp licationModel()
at
Microsoft.Visua lBasic.Applicat ionServices.Win dowsFormsApplic ationBase.Run(S tring[] commandLine)
at WindowsApplicat ion1.My.MyAppli cation.Main(Str ing[] Args) in
17d14f5c-a337-4978-8281-53493378c1071.v b:line 81
at System.AppDomai n.nExecuteAssem bly(Assembly assembly, String[] args)
at System.AppDomai n.ExecuteAssemb ly(String assemblyFile, Evidence
assemblySecurit y, String[] args)
at Microsoft.Visua lStudio.Hosting Process.HostPro c.RunUsersAssem bly()
at System.Threadin g.ThreadHelper. ThreadStart_Con text(Object state)
at System.Threadin g.ExecutionCont ext.Run(Executi onContext
executionContex t, ContextCallback callback, Object state)
at System.Threadin g.ThreadHelper. ThreadStart()
-----------------------------------------------------------------------------------
--
Thanks in advance for your replies!
Jun 11 '07 #1
0 4611

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

Similar topics

2
1718
by: Angelos Karantzalis | last post by:
Hi, can anybody point me to some info in how to write to the event viewer ? I've build a COM+ component, and I have no real way to get information on the possible exceptions that occur during execution :( Cheers, Angel O:]
3
7960
by: Angelos Karantzalis | last post by:
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...
3
3966
by: veera sekhar kota | last post by:
hi, im seriously looking for right answer .... We are developing windows application in c#. I implemented DAAB(Data Access Application Block) 2.0 in our application. One of the senior asked me to implement DAAB in enterprise library. I said DAAB 2.0 having more performance(data accessing) compare to enterprise library DAAB. And we not using the features of DAAB in enterprise
22
3306
by: EP | last post by:
When running my asp.net hosting service (asp.net without IIS), on server 2003 with IIS not installed, I get the following when trying to process a request. "System.DllNotFoundException: Unable to load DLL (aspnet_isapi.dll)." Of course the dll is able to be found, it's still in the framework directory and for grins I even put it in my service's local directory. This is apparantly server 2003 not allowing asp.net to be run if IIS was not...
0
5014
by: Eniac | last post by:
Hello, I've started using Enterprise Library 2.0 recently and I've encountered a problem that seems to be ... well... undocumented :) Basically, when I set a Trace Listener (formatted event log to be precise), if i specify the name of a custom event log, the listener won't log in it. I've checked in the registry, the log is there. In the event viewer, I
1
4033
by: Terrance | last post by:
I'm trying to create a small messenger program that uses the tcpclient and tcplistenter objects. When I start the application and run the thread that fires the tcplistener; once the client sends data then closes the stream and the connection I receive the message Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. How can I keep the connection listener listening for new traffic?...
1
1568
by: GaryDean | last post by:
I now have installed (from the same install) Enterprise Library - January 2006 and Enterprise Library - June 2005. The install for these two was called Enterprise Library for .Net 2.0. (not Enterprise Library 2.0). I then discovered that there is an Enterprise Library 3.1 - May 2007. So I want to install that because it is the latest. The instructions, however, say that if I already have Enterprise Library 3.0 installed, I must...
5
12372
by: =?Utf-8?B?TWljaGFlbFF1aW5sYW4=?= | last post by:
In my development environment I can add references to the Microsoft Practices libraries and everything works ok. But when I copy the application to the test server I get the message "CS0234: The type or namespace name 'Practices' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)". A search of the web suggests that I am missing an assembly reference (exactly as the message says). I cannot find any place...
53
8422
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script language="javascript" type="text/javascript">
0
9688
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
9546
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,...
1
10247
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
10031
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
9079
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
7571
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
6809
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();...
1
4146
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
2941
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.