Failed to CoCreate Profiler error - but not using a profiler

32

We're getting a:

.NET Runtime version 2.0.50727.5448 - Failed to CoCreate profiler

message in the Event Viewer on our webserver, along with an accompanying:

.NET Runtime version 4.0.30319.239 - Loading profiler failed during CoCreateInstance. Profiler CLSID: '{d37a1b78-6dc5-46fc-bc31-f7c4d5a11c9c}'. HRESULT: 0x8007007e. Process ID (decimal): 224. Message ID: [0x2504].

The thing is, we're not trying to use a profiler, there are no profiler's running or installed on the server and the code makes no reference to profilers anywhere...

We've tried removing the registry keys that other's have pointed out are related to these messages but to no avail; it would seem that two of our websites/webapps are firing off the error, one using .Net2 and the other using 4, but I'm not sure where to look.

asp.net
.net
iis
profiler
asked on Stack Overflow Apr 4, 2012 by Dale • edited Aug 17, 2017 by valiano

9 Answers

27

After much searching I found that someone had previously installed dotTrace, then uninstalled it, however the uninstall wasn't very clean and had left the registry littered with entries, though we'd removed some entries we thought could stop the problem there were more specific to that profiler.

After removing all registry entries related to dottrace and the CSID it presented we no longer have the error appearing in the event viewer.

See this answer for a script to aid in hunting down such entries: https://stackoverflow.com/a/36129656/361842

answered on Stack Overflow Apr 5, 2012 by Dale • edited May 25, 2017 by JohnLBevan
18

Removing Environment variable COR_ENABLE_PROFILING (or set it to 0) from User variables (Control panel > System > Advanced system settings > Environment variables) solved my problem (Could not start MongoVUE)

answered on Stack Overflow Mar 13, 2014 by Andreas
14

While removing all the references to the profiler's CLSID in the registry can't be a bad thing, you can also choose to just disable profiling by setting the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\COR_ENABLE_PROFILING to 0

answered on Stack Overflow Oct 17, 2013 by Kevin Gosse
11

To help find where this tool may be used, the below PowerShell code can be used to help detect environment variables and registry entries relating to the profiler:

clear-host
if (-not (get-psdrive HKU)) {
    New-PSDrive HKU Registry HKEY_USERS
    Set-Location HKU:
}
"COR_ENABLE_PROFILING: $env:COR_ENABLE_PROFILING "
"COR_PROFILER: $env:COR_PROFILER"
$GUID = $env:COR_PROFILER
@(
    "HKLM:\Software\Classes\CLSID\$GUID",
    "HKLM:\SOFTWARE\Classes\Wow6432Node\CLSID\$GUID",
    "HKLM:\SOFTWARE\Wow6432Node\Classes\CLSID\$GUID",
    "HKU:\*\Software\Classes\CLSID\$GUID"
) |
    get-item  | 
    %{$p = $_.Name;Get-ItemProperty $_.PSPath ''} | 
    select @{N='Path';E={$p}}, '(default)'

get-itemproperty 'HKLM:\SYSTEM\CurrentControlSet\Services\*\' 'Environment' -ea SilentlyContinue | 
    %{
        $serviceName = $_.PSChildName
        $x = new-object PSObject -Property @{ServiceName=$serviceName}
        $_ | select -expand Environment | 
            %{if($_ -match '^(?<Name>[^=]+)(=)?(?<Value>.*)$'){$x | Add-Member -MemberType NoteProperty -Name $matches['Name'] -Value $matches['Value']}}
        $x
    } |
    ?{$_.COR_ENABLE_PROFILING -eq 1} | 
    ft ServiceName, COR_ENABLE_PROFILING, COR_PROFILER, NEWRELIC_INSTALL_PATH -AutoSize

Hope that helps others in future.

answered on Stack Overflow Mar 21, 2016 by JohnLBevan • edited Mar 21, 2016 by JohnLBevan
7

regedit

  1. Use regedit do a Data search for the CLSID value in the error log
  2. Remove COR_PROFILER and its value
  3. Change Cor_Enable_Profiling=1 to Cor_Enable_Profiling=0
  4. Do not remove the Cor_Enable_Profiling setting for any of the following:
     HKEY_LOCAL_MACHINE\SYSTEM\Services\WAS
     HKEY_LOCAL_MACHINE\SYSTEM\Services\W3SVC
     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\IISADMI‌​N
    
    Doing so may cause IIS to fail to start. See this question for more details.
  5. You may also need to remove/disable additional User and System variables. Try disabling first (COR_ENABLE_PROFILING = 0) delete if error persist. Hope that helps. Thank you @Andreas and @Mike-Monkey for the initial guidance.

Environment Variables

answered on Stack Overflow Jan 31, 2017 by Geovani Martinez • edited Jul 31, 2019 by Phil
1

For us COR_ENABLE_PROFILING was at multiple places

HKEY_LOCAL_MACHINE\SYSTEM\\Services\W3SVC and HKEY_LOCAL_MACHINE\SYSTEM\\Services\WAS

answered on Stack Overflow Aug 7, 2015 by Mike-Monkey
0

Stackify Profiler Will also do the same thing to you. :(, I am finding it difficult to remove from the registry.

answered on Stack Overflow Oct 6, 2016 by Omzig
0

We see this problem from time to time when trying to start Windows Services.
This issue is invariably that the app.config for the executable is corrupt (not valid xml).
Double checking that your app.config is valid xml is a quick easy thing to check before heading of to edit registry settings..

answered on Stack Overflow Mar 6, 2018 by Scott
0

Things did not work even after doing what mentioned in Answer from Agnes. In my case, I had my application pool set to an account and it's password was expired...

answered on Stack Overflow Aug 29, 2018 by user007

User contributions licensed under CC BY-SA 3.0