Unable to Profile a Remoting Host Running Under IIS

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
gmancoll
Posts: 6
Joined: Mon Jan 18, 2010 11:19 am

Unable to Profile a Remoting Host Running Under IIS

Post by gmancoll » Mon Jan 18, 2010 11:26 am

Hi,

I'm attempting to profile a remoting host which is running under ASP.Net. I've selected to profile an ASP.Net application and to launch using IIS and have not selected a page which should be requested to start the ASP.NET application. When I start profiling a dialog is shown which states "Wating for profiled processes to start...". I then go and run my application which results in requests being made to the remoting host (and the ASP.Net process to start - I can see w3p in my processes list). However, the profiling does not start and the profiler sits with that same dialog being shown.

I'm using version 3.5 and the application is running under .Net 3.5. Any indication of where I am going wrong would be much appreciated?

Thanks in advance,

Graham

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Re: Unable to Profile a Remoting Host Running Under IIS

Post by Andreas Suurkuusk » Tue Jan 19, 2010 3:40 pm

I can't see anything wrong from your description. If the w3wp process has been started, then the profiler should be able to connect to it. Are you able to profile "normal" ASP.NET applications using IIS?

What application pool settings are you using? Are you using the built in "NetworkService" as the identity, or are you using a custom account? What OS are you running under and what version of IIS are you using?
Best regards,

Andreas Suurkuusk
SciTech Software AB

gmancoll
Posts: 6
Joined: Mon Jan 18, 2010 11:19 am

Re: Unable to Profile a Remoting Host Running Under IIS

Post by gmancoll » Thu Jan 21, 2010 10:02 am

Hi,

I'm using Vista Business edition and its IIS version 7.0 and yes the application pool is running under NetworkService.

I've tried profiling another "normal" ASP.Net application and specifying a page to be launched to start the application and even in that case the profiler still hangs on the "Waiting for profiled processes to start" dialog.

Thanks,

Graham

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Re: Unable to Profile a Remoting Host Running Under IIS

Post by Andreas Suurkuusk » Thu Jan 21, 2010 10:18 pm

I have performed some tests running IIS 7 and Vista, with a few different configurations, but I have not been able to find a problem with ASP.NET IIS profiling.

Are you able to profile a standard Windows Forms application?

Maybe there's a problem with the installation. Can you try to reinstall the profiler using the steps below:
  1. Exit all .NET Memory Profiler, Visual Studio, and Document explorer instances.
  2. Uninstall .NET Memory Profiler
  3. Restart the computer (to make sure that there are no pending installations/uninstallations)
  4. Reinstall .NET Memory Profiler
Are you still unable to profile ASP.NET under IIS after reinstalling?
Best regards,

Andreas Suurkuusk
SciTech Software AB

gmancoll
Posts: 6
Joined: Mon Jan 18, 2010 11:19 am

Re: Unable to Profile a Remoting Host Running Under IIS

Post by gmancoll » Fri Jan 22, 2010 9:04 am

Hi,

the problem still remains after reinstall. However I had a thought and maybe you could confirm whether or not this is the case. The machine I'm trying to run the profiler on is a 64-bit Vista machine and I've installed the 64 bit version of the profiler. However, the ASP.Net applications that I'm trying to profile are running as 32 bit applications (w3wp is running as a 32 bit process). Would this have any affect on the profiler's ability to attach to the process? If so would I have to install both the 32 bit and 64 bit versions?

Thanks in advance,

Graham

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Re: Unable to Profile a Remoting Host Running Under IIS

Post by Andreas Suurkuusk » Fri Jan 22, 2010 5:19 pm

Maybe we can get some more information about this problem if we can take a look at the log files.

Could you try to run the profiler with logging enabled and send us the log-files? To create log files, you need to supply the /log:<path> command line argument to the profiler executable. E.g. running the following command:

"c:\Program files\SciTech\NetMemProfiler3\NetMemProfiler.exe" /log:c:\MemProfilerLogs

When profiling, two files will then be created in the C:\MemProfilerLogs directory: ProfilerLog.txt and ProfilerClientLog.txt. Can you send these files to support@scitech.se (preferably zipped)?
Best regards,

Andreas Suurkuusk
SciTech Software AB

gmancoll
Posts: 6
Joined: Mon Jan 18, 2010 11:19 am

Re: Unable to Profile a Remoting Host Running Under IIS

Post by gmancoll » Mon Jan 25, 2010 10:38 am

Hi,

I've run the profiler with the requested command line but I only get a single log file, ProfilerClientLog.txt, created in the log directory. I've zipped it and sent it to the support address as requested (but its only 6KB in size so I'm not sure if its going to be very useful.

Thanks,

Graham

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Re: Unable to Profile a Remoting Host Running Under IIS

Post by Andreas Suurkuusk » Mon Jan 25, 2010 3:43 pm

Thanks for the log-file.

From what I can see in the log file, everything is initialized correctly, but the ASP.NET application does not seem to load the profiler at all. Can you take a look in the Application event log and see if there are any error messages from the .NET runtime?

In order for the profiler library to be loaded by the .NET runtime a few environment variables need to be initialized correctly. Can you check whether the profiler environment variables have been set? The environment variables of the ASP.NET process can be presented by adding the following code to the Page_Load method of an ASP.NET page and then request that page when profiling.

Code: Select all

foreach( DictionaryEntry de in Environment.GetEnvironmentVariables() )
{
  this.Response.Write( de.Key.ToString() + " : " + de.Value.ToString() + "<br>" );
}
If the environment variables are correctly set you should see entries like:

cor_profiler : {E82491FC-2234-4FFC-BC73-D05B27FF3B0F}
Cor_Enable_Profiling : 1

If logging is enabled the cor_profiler entry will be "{E95139A2-BEC5-443C-A719-0516B4F0379F}" instead.

If you don't see a cor_profiler variable, then the initialization of environment variables has failed for some reason. If you see another cor_profiler value, then there might be a conflict with another profiler.
Best regards,

Andreas Suurkuusk
SciTech Software AB

gmancoll
Posts: 6
Joined: Mon Jan 18, 2010 11:19 am

Re: Unable to Profile a Remoting Host Running Under IIS

Post by gmancoll » Tue Jan 26, 2010 4:42 pm

Hi,

I knocked up a sample web application and added the code that you suggested and tried to profile it. I've pasted the values of the relevant environment variables below:

cor_profiler : {0a56a683-003a-41a1-a0ac-0f94c4913c48}
cor_enable_profiling : 1
COR_GC_PROFILING : 0
COR_LINE_PROFILING : 1

Having googled that GUID it appears that it is the VSPerfMon profiler that is conflicting. I did have a failed attempt at getting that profiler to work on my machine but it seems that its left its mark! Is there an easy way that you know of to restore the Scitech Profiler to be the default?

Thanks for all your help on this,

Graham

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Re: Unable to Profile a Remoting Host Running Under IIS

Post by Andreas Suurkuusk » Wed Jan 27, 2010 3:24 pm

The left-over cor_profiler GUID is what's causing the profiler to fail to connect to IIS. Can you search through the registry for this GUID and provide me with information where it was found. There are several locations in the registry where this variable can be stored, and to avoid this problem in the future it would be good for us to know where it's stored.

After you have found the variable in the registry, it should be safe to remove it (the cor_profiler variable should only be set temporarily). If it's stored in a Multi-string value, be careful so you don't remove other environment variables.
Best regards,

Andreas Suurkuusk
SciTech Software AB

gmancoll
Posts: 6
Joined: Mon Jan 18, 2010 11:19 am

Re: Unable to Profile a Remoting Host Running Under IIS

Post by gmancoll » Wed Jan 27, 2010 4:36 pm

Hi,

removing that GUID from all of the following locations seems to have solved the issue:

HKEY_LOCAL_MACHINE\System\ControlSet001\Services\IISADMIN\Environment
HKEY_LOCAL_MACHINE\System\ControlSet001\Services\W3SVC\Environment
HKEY_LOCAL_MACHINE\System\ControlSet001\Services\WAS\Environment
HKEY_LOCAL_MACHINE\System\ControlSet003\Services\IISADMIN\Environment
HKEY_LOCAL_MACHINE\System\ControlSet003\Services\W3SVC\Environment
HKEY_LOCAL_MACHINE\System\ControlSet003\Services\WAS\Environment
HKEY_Users\S-1-5-20\Environment\COR_PROFILER

Unfortunately I cannot tell which key was the offender!

Thanks for helping me resolve this issue,

Graham

apsa
Posts: 1
Joined: Tue Aug 03, 2010 6:05 am

Re: Unable to Profile a Remoting Host Running Under IIS

Post by apsa » Tue Aug 03, 2010 8:32 am

Andreas Suurkuusk wrote:Thanks for the log-file.

From what I can see in the log file, everything is initialized correctly, but the ASP.NET application does not seem to load the profiler at all. Can you take a look in the Application event log and see if there are any error messages from the .NET runtime?

In order for the profiler library to be loaded by the .NET runtime a few environment variables need to be initialized correctly. Can you check whether the profiler environment variables have been set? The environment variables of the ASP.NET process can be presented by adding the following code to the Page_Load method of an ASP.NET page and then request that page when profiling.

Code: Select all

foreach( DictionaryEntry de in Environment.GetEnvironmentVariables() )
{
  this.Response.Write( de.Key.ToString() + " : " + de.Value.ToString() + "<br>" );
}
If the environment variables are correctly set you should see entries like:

cor_profiler : {E82491FC-2234-4FFC-BC73-D05B27FF3B0F}
Cor_Enable_Profiling : 1

If logging is enabled the cor_profiler entry will be "{E95139A2-BEC5-443C-A719-0516B4F0379F}" instead.

If you don't see a cor_profiler variable, then the initialization of environment variables has failed for some reason. If you see another cor_profiler value, then there might be a conflict with another profiler.
Hi ,i am unable to profile remoting host too.
have tried to do as suggested
there is no information on cor_profiler..
any other way to determine cor_profiler or cause why the profiling failed?

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 26 guests