I developed a Console application which monitored HTTP requests using the third party component called Fiddler (fiddlerCore). This works as expected.
I need to convert this functionality into a Windows Service. The code is the same as the console application except for that it is in a Windows Service.
I can install the service and start it correctly but none of the events which monitor HTTP requests are executed.
I am wondering if it is to do with any of the following:
1. Can Windows Services monitor HTTP requests?
2. After the Onstart method has finished executing can events still be triggered?
Here is the Onstart code of my service
Expand|Select|Wrap|Line Numbers
- try
- {
- Fiddler.FiddlerApplication.OnNotification += delegate(object sender, NotificationEventArgs oNEA) {
- EventLog.WriteEntry("App", "Notification " + oNEA.NotifyString);
- };
- Fiddler.FiddlerApplication.Log.OnLogString += delegate(object sender, LogEventArgs oLEA) {
- EventLog.WriteEntry("App", "logstring " + oLEA.LogString);
- };
- Fiddler.FiddlerApplication.BeforeRequest += delegate(Fiddler.Session oS)
- {
- EventLog.WriteEntry("App", oS.fullUrl);
- };
- Fiddler.FiddlerApplication.BeforeResponse += delegate(Fiddler.Session oS)
- {
- EventLog.WriteEntry("App", "before response " + oS.url);
- };
- Fiddler.FiddlerApplication.AfterSessionComplete += delegate(Fiddler.Session oS) {
- EventLog.WriteEntry("App", "finished session " + oS.url);
- };
- Fiddler.CONFIG.IgnoreServerCertErrors = false;
- FiddlerApplication.Startup(8877, FiddlerCoreStartupFlags.MonitorAllConnections);
- EventLog.WriteEntry("App", "Started service");
- }
- catch (Exception ex)
- {
- EventLog.WriteEntry("App", ex.ToString());
- }
Does anyone know what I am missing?
Thanks,
Andrew