Question

I am running a .net application using TopShelf, part of which is to process and save data into a Sql Server database.

I've found that the process is quite slow so I want to look into profiling the application to see if there are any major bottlenecks in terms of method calls etc, however, since TopShelf is running the application, any profiling tools I use just sit on the Run method in the main program and do not show any results from the remainder methods.

Is there a way to allow a profiling tool to continue profiling past the point where TopShelf runs the application?

Was it helpful?

Solution

With Topshelf, you can run your service as a console application for debugging and profiling purposes. To do this, make sure that your service is not installed, and just run it from the console (or set it as the program to profile inside your profiler). Then once your service has run for enough time to get a good profile trace, stop it with Control+C in the console, and it will exit gracefully allowing the profiler to get a good trace.

I do this all the time with dotTRACE on my system.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top