ANTS Performance Profiler 5 - IIS 5.1 ASP.NET Error

Error while setting environment variables on user
at bJ.Launch()
at RedGate.Profiler.Session.ProfilerSession.j()

Caused by:

Error while setting environment variables on user
at bQ.PerformLaunch()
at bJ.Launch()

Caused by:

Error while setting environment variables on user
stack trace:
at bx.SetupEnvironment(String currentUserName, String subprocessVariableValue)
at bo.StartProfilingIIS(String currentUserName, String subprocessVariableValue)
at RedGate.Profiler.Engine.Startup.IIS.IISStarter`1.StartProfilingIIS(String currentUserName, String subprocessVariableValue)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at RedGate.Profiler.Engine.Startup.IIISActuator`1.StartProfilingIIS(String currentUserName, String subprocessVariableValue)
at bQ.PerformLaunch()

Caused by:

Failed to get user profile
at bx.a(String , String , String )
at bx.SetupEnvironment(String currentUserName, String subprocessVariableValue)


  • Did you by any chance ever install "YourKit"? That program does cause conflict with ANTS- especially regarding environment variables.

    Can you try checking your registry to see if the environment variable
    COR_PROFILER is enabled for the ASPNET user?

    First, try checking the default environment settings using regedit in
    HKEY_USERS\.Default\Environment to see if COR_PROFILER is set.

    Next, check to see if the ASPNET account has its' own environment settings.
    I don't think it will unless it's logged in interactively. To check this,
    you'd need the ASPNET account's SID, which you can get by saving the
    following VB code to a file and running with cscript.exe:

    'VBScript to Enumerate Accounts, and SID
    On Error Resume Next
    if Err <> 0 Then
    set lasterr = CreateObject("WbemScripting.SWbemLastError")
    Wscript.echo lasterr.Operation
    End if

    'Get the local machine name
    set WshShell = WScript.CreateObject("WScript.Shell")
    SET WshEnv=WshShell.Environment("PROCESS")
    Dim Machinename

    set objWMIService = GetObject("Winmgmts:\\" & Machinename)
    set colAccounts = objWMIService.InstancesOf("win32_Account")
    For each objAccount In colAccounts
    If"ASPNET" AND objAccount.Domain=Machinename Then
    WScript.echo "Name " & & vbCRLf & _
    "SID : " & objAccount.SID & vbcrlf & _
    "Sid Type : " & objAccount.SIDType & vbcrlf & _
    "Status : " & objAccount.Status & vbcrlf & _
    "Domain : " & objAccount.Domain & vbcrlf & _
    "Caption : " & objAccount.Caption
    End if

    Check HKEY_USERS\<SID>\Environment and see if COR_PROFILER appears in there.

    When we need to profile services (such as IIS), we usually edit the service environment to contain the variables necessary to hook ANTS in. We added some code in a recent version that also changes the permissions on the temp directory to allow the UI and the service to read and write the same files (which is required for profiling), which has caused some issues for some people.

    For IIS 5 we change the variables for the user that ASP.NET is running as, due to the different way it starts up.

    It's usually not critical when the variables get left behind, as the core will disable itself if it's loaded into an application that doesn't need to be profiled.

    When the Core DLL is installed, we register it with COM+, and we unregister it when the profiler is uninstalled.

    Apart from that we don't make any changes to the system that could become permanent: for plain old desktop apps there's no need to change the registry to get the profiler to load in.
  • I searched for COR_PROFILER in the registry and coudnt find any. The application user is in the administrators group. Let met try uninstalling and installing the application again!
  • Uninstall >> Reboot > Install also get the same error. Any help will be appreciated!
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    I had run into a few cases where the environment couldn't be modified because the ASPNET user profile was corrupt and Windows had created a "temporary" profile for it which is not writable. You can see evidence of this in the system event logs under the category "userenv".

    If this happens, a reboot may clear it up, but on the extreme end, you may have to delete ASPNET's profile and allow Windows to recreate it by accessing an ASP .NET application on the computer (outside of Profiler).
Sign In or Register to comment.