"Unable to start profiling. The system cannot find the file specified" error occurs if attach to Windows Service process


When you attach the profiler to the process, it shows the message "Preparing the profiler..." for about 1 minute and then fails with the error:

"Unable to start profiling. The system cannot find the file specified".


Possible cause:

CLR doesn't start the "attach" thread for the application.

To resolve the issue:

1) Open regedit.exe

2) Find HKLM\SYSTEM\CurrentControlSet\Services\<YourServiceName>

3) Add new multi-string value (REG_MULTI_SZ) with "Environment" name

4) Add value COMPlus_AttachThreadAlwaysOn=1 , then press Enter to get empty new line

Environment key

5) Click OK

6) Restart your service



1 out of 2 found this helpful

Those are my symptoms, but I'm attaching to a service, I am attaching to a .NET 4 Framework app. This is a new PC and worked on my previous one, so I'm assuming it's a configuration error.




What kind of application do you try to attach to? Is it standalone application, IIS or probably something else?

Anyway, could you please try to set COMPlus_AttachThreadAlwaysOn=1 variable for your application and check if this issue occurs after it?

You can do it e.g. from command line (for standalone application):

- Run cmd

- Execute "set COMPlus_AttachThreadAlwaysOn=1" without quotes

- Run your application from this command line


Edited by Anna Guseva

Please sign in to leave a comment.

Have more questions?

Submit a request