Search code examples
c#.netwindows-serviceshealth-monitoring

SqlWebEventProvider w/ windows service


I am trying to raise some custom events to a SqlWebEventProvider from a windows service. Here are the steps I have taken and the results I have seen. I cannot figure this one out.

  1. Setup 2 healthMonitoring providers SqlWebEventProvider, and SimpleMailWebEventProvider (both .net 2.0 framework, and sqlwebeventprovider is basically the default one w/ modified connection string name)

  2. Setup website and windows service that both raise same event type

  3. Moved healthmonitoring element from global web.config to machine.config (so windows service could pick up the configuration).. (the healthmonitoring defaults are located in global web.config, so they would not be inheritable from windows services, so this is why i had to move the defaults to machine)

Here is what I did to test

To test this scenerio, I raised an event from the website to both providers and it worked fine. Then in the windows service I raised the events to both and it only works to the SimpleMailWebEventProvider. I made sure that the connection strings were correct for the SqlWebEventProvider (they are both getting conn string from machine.config).

I copied the entire HealthMonitoring element from the web.config to the windows service config file and still get the same behavior.

I restarted the service, uninstalled it reinstalled it... still, same behavior.

Here is what I know for sure

  • There is nothing wrong with the providers, both will work from website.
  • Websites and web services can inherit from machine.config the same way
  • The connection string is correct
  • The events are raising
  • The events can raise to the SimpleMailWebEventProvider for both windows service and website
  • The events can raise to the SqlWebEventProvider only from the website

Solution

  • I found the issue

    'aspnet_WebEvent_LogEvent' expects parameter '@ApplicationPath', which was not supplied.