asp.net-mvc-3web-setup-projectevent-viewer

Create an EVENT SOURCE using web setup project


I am developing a website using MVC 3,

I have a web setup project for installing it to my localhost.

Now what I want is to create an EVENT SOURCE ( where I will later on log using my website ) using this very setup.

Is this possible?

I have been following this link: http://msdn.microsoft.com/en-us/library/ms998320.aspx#paght000015%5Feventlogaccess

I earlier tried creating an EVENT SOURCE programmatically, but my web app threw security exceptions, similar to the error the user in this post was getting: System.Security.SecurityException when writing to Event Log

Thanks in advance Yasser


Solution

  • After a lot of struggle I myslef managed to answer my question

    1. I first had to create a seperate installer class, which had code to install an event source.

    2. Next in my web setup project, under custom action in INSTALL, I simply added the output of the above project which was a single dll.

    and thats it!

    Now whenever my web setup runs, the installer dll is also activated and run and my event source gets created.

    Now that was not too difficult was it ? ;)