Profiling Web App, Unable to start Profiler, Error code 2...

XP system with a web app running on http://localhost

After I choose the project, and it is playing with IIS, the progress bar goes to 100% and then I get an alert with the text:

Unable to start profiler - exception details System.Exception: Unable to set profiling environment data for ASP.NET user - Error code 2
Any ideas? Thank you much.

The full error text is...

Unable to start profiler - exception details System.Exception: Unable to set profiling environment data for ASP.NET user - Error code 2

Server stack trace:
at RedGate.Profiler.Engine.ProfileIISController.ᐁ(IntPtr , String , String )
at RedGate.Profiler.Engine.ProfileIISController.ᐆ(String )
at RedGate.Profiler.Engine.ProfileIISController.StartProfilingIIS(String currentUserName, String url)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(MethodBase mb, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [0]:
at RedGate.Profiler.Engine.ProfilingSession.StartProfiler()
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(MethodBase mb, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [1]:
at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
at System.Windows.Forms.MethodInvoker.EndInvoke(IAsyncResult result)
at ᐃ.ᐄ(IAsyncResult )

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hello,

    ANTS Profiler needs to set up the user's environment for profiling. The first step is when ANTS Profiler finds out who the ASPNET user is in machine.config. The next step is that it wants to write some environment information into that user's environment block in the HKEY_USERS registry hive.

    There are a few possibilities: First, but unlikely, ASPNET account does not have write permissions to its' own registry hive. The Profiler uses a batch logon to impersonate the ASPNET user, so you yourself do not need to write to ASPNET's registry area.

    More likely, ASPNET needs the 'log on locally' right. It's possible that the profile for the ASPNET user had never been created on the machine.

    Please let me know what you find out.
  • Brian,
    I do have an ASPNET user, and I know that that damn ASPNET user has been a problem in the past. Pardon my ignorance, but how does the ANTS Profiler find out who the ASPNET user is in machine.config? That would give me a great start. I went ahead and made sure that the ASPNET account had full permissions on the HKEY_USERS hive. I know that we've had some strange things happen that were "fixed" when we manually set permissions in the registry, but that was a year ago - its a little fuzzy unfortunately! Thanks for your quick response last time, by the way.
  • AHA!!! I changed the username in Machine.config to SYSTEM instead of ASPNET, and it works great now... Here's the snippet in case anyone else needs to see it...

    <processModel
    enable="true"
    timeout="Infinite"
    idleTimeout="Infinite"
    shutdownTimeout="0:00:05"
    requestLimit="Infinite"
    requestQueueLimit="5000"
    restartQueueLimit="10"
    memoryLimit="60"
    webGarden="false"
    cpuMask="0xffffffff"
    userName="SYSTEM"
    password="AutoGenerate"
    logLevel="Errors"
    clientConnectedCheck="0:00:15"
    comAuthenticationLevel="Connect"
    comImpersonationLevel="Impersonate"
    responseDeadlockInterval="00:07:00"
    maxWorkerThreads="20"
    maxIoThreads="20"
    />

    Thanks for your help, your profiler is Awesome! I have tried about 7, and yours is the only one that is even remotely helpful!
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hello,

    Thanks. Maybe I don't explain this well enough, though, because I ask people to look there so often I take it for granted that they know where to look already. Yes, it's the processModel section of Machine.config. MACHINE uses LocalSystem to run the ASP .NET code (NOT recommended!!!) and SYSTEM tells .NET to run under a more limited ASPNET account.

    ANTS Profiler asks machine.config which account ASP .NET is running under. Then it does a 'batch' logon as that user and tries to write to its' user hive and then launch the worker process.
This discussion has been closed.