The fact that windows services run indefinitely causes some challenges to Loupe.
The Loupe Agent defines a session as matching the lifespan of a single Application Domain. Each Windows Service has a root application domain that lasts the lifespan of the process. Therefore, by default a session corresponds to the entire life of the process. The only way to shorten a session would be to create a child application domain for the body of your application which periodically exits and is recreated.
You can always perform analysis right on the server using the Loupe Desktop, but in most environments you'll want to send the data to your client so you can dig deep.
For more information on all of the different ways you can package up data for analysis, see Developer's Guide - Packaging and Sending Data.
Until the windows service exits the session data will stay on the server unless it is packaged from within the service process or the current log file ends. It's a best practice to do two minor code additions within your service:
For more information on how to do this see Developer's Guide for ASP.NET - Submitting Sessions on Error.
If the number of instances of the service is reasonably limited you should also consider enabling network live view. Working with the Loupe Server this will allow you to remotely see into the service in real time.
Since the Loupe Agent is a strongly named assembly a minor startup delay can happen as the .NET framework validates the signature. Microsoft recommends that you disable strong name validation for Windows Services:
Changes to the Windows Service App.Config File |
Copy Code
|
---|---|
<configuration> <runtime> <generatePublisherEvidence enabled="false"/> </runtime> </configuration> |
You can safely initialize the Loupe Agent explicitly on the main service thread since the initialization is sufficiently fast and non-blocking.