I am trying to profile a windows service that takes in the order of 1 to 2 minutes to start. Normally after about 30 seconds the Windows Services Manager says that the service has failed to start. However, the service is still starting and everything is OK after a couple of minutes.

When I try to attach .NET Memory Profiler via the "File->Profile Service ..." menu option I get the same error except that the profiler appears to give up on the session. Is there any way that I can tell .NET Memory Profiler to wait longer for my service to start?

Currently the profiler only wait for one minute when starting services. If the service takes longer than that to start, the profiler may fail to connect to the service.

There is currently no way of telling the profiler to wait longer, but we will modify the service connection behaviour in future versions. This modification will allow you to profile services which take a long time to start.

The next (minor) release of the profiler will connect a little bit differently to services, and it should be possible to connect to a service that takes a long time to startup (at least if the profiled service doesn't have any dependent services).

I just resently downloaded and purchased the profiler. Excellent product! I really like the live time graphing. It helped me find a small memory leak in a service which would have gone undetected for quite a while.

My service takes 1 minute for its start up, does its monitoring, then "snoozes" for another minute, wakes up and does its monitoring, snoozed for 1 minute, etc. The profiler worked fine even with the 1 minute pauses.

I was thinking, as an alternative until the minor revision comes out, you can add a temporary timer and timer event handler to your service to do something non-critical prior to the actual start up of the service. That way, if the profiler isn't profiling due to the long initial start up, at least the temporary timer and event handler will trigger the profiler into action. Then, once profiling and code changes (if needed) are complete, remove the temp. timer and its event handler prior to production.

mpernal: I don't think your solution will work. The profiler waits for the Service Manager to tell it that the service is fully started, and the service is fully started when it returns from OnStart().

Anyway, we just released a new version (v2.6.64). This version allows you to profile services that takes more than 60 seconds to start.