This topic describes profiling of Internet Information Services (IIS) applications created with unmanaged (ordinary) compilers. Using .NET compilers provided by Microsoft Visual Studio, you can create IIS applications that use .NET assemblies. For more information on how to profile these applications, see Profiling ASP.NET Applications. To learn how to profile Windows services, review Profiling Services.
2. Preparing Application for Profiling
2.1. Setting Up Properties of IIS 4 - 6 Applications
Requirements
-
Profiling IIS applications requires a 32-bit or 64-bit edition of Windows XP, Windows Server 2003 or a later operating system and Internet Information Services ver. 4.0 - 7.5.
-
Currently, AQTime can profile only those IIS applications, whose “bitness” corresponds to the “bitness” of the operating system. That is, if you run AQTime on a 64-bit operating system, it will only be able to profile 64-bit applications. If you run AQTime on a 32-bit operating system, it will only be able to profile 32-bit applications.
1. Configuring IIS
In our explanations, we assume that IIS is running in the default configuration. If it is running under a user account, you should specify certain permissions for this account. Follow the link for more information about this.
If you use IIS ver. 4 - 6, Disable the Cache ISAPI applications setting of IIS:
-
Open the Internet Information Services Manager dialog (Control Panel > Administrative Tools > Internet Information Services).
-
Right-click the root node of your Web site and select Properties from the context menu. This will open the Properties dialog for the root virtual directory.
-
In the dialog, switch to the Home Directory page and press Configuration there:
The Application Configuration dialog will appear.
-
Uncheck the Cache ISAPI applications box there and click OK to save changes:
For 64-bit versions of IIS: On 64-bit operating systems, 64-bit processes cannot load 32-bit DLLs and 32-bit processes cannot load 64-bit libraries. So, if your IIS application is a 32-bit application and you are going to run it on a 64-bit version of IIS, then you must configure IIS in order for it to be able to run your application.
To do this, open the command-line window, type the following command and press Enter :
cscript %SystemDrive%\inetpub\AdminScripts\adsutil.vbs SET W3SVC/AppPools/Enable32BitAppOnWin64 1
2. Preparing Application for Profiling
To profile your IIS application with AQTime, you must compile it with debug information. For information on the required compiler settings, see Compiler Settings for Native Applications and Compiler Settings for .NET Applications.
Also, you need to configure your IIS application as described below. The procedure depends on the IIS version you use.
2.1. Setting Up Properties of IIS 4 - 6 Applications
To configure an application running IIS ver. 4 - 6 for profiling, follow these steps:
-
Open the Internet Information Services Manager dialog (Control Panel > Administrative Tools > Internet Information Services).
-
Create a virtual directory for your IIS application. To do this, right-click the Default Web Site node and select New > Virtual Directory from the context menu:
Then follow the instructions of the ensuing dialog.
-
In the Internet Information Services Manager, right-click your virtual directory and select Properties from the context menu.
-
The Properties dialog will appear. In the dialog:
-
Switch to the Directory tabbed page.
-
Select Scripts and Executables in the Execute permissions drop-down list.
-
Remember or write down the value of the Application Protection option of your IIS application. We will need it later.
-
Press OK to save changes.
-
-
If you set the Application Protection option in the Properties dialog to High (Isolated) or Medium (Pooled), you should modify properties that specify the user account, under which the IIS process will run. To do this:
-
Open Control Panel > Administrative Tools > Component Services.
-
Expand the tree down to the node Console Root > Component Services > Computers > My Computer > COM+ Applications > IIS Out-of-Process Pooled Applications.
-
Right-click the IIS Out-of-Process Pooled Applications node and select Properties from the context menu. The IIS Out-of-Process Pooled Applications Properties dialog will appear.
-
Switch to the Identity page of this dialog and set the Account option to Interactive user.
-
Close the dialog by pressing OK.
-
2.2. Setting Up Properties of IIS 7 - 7.5 Applications
To configure an application running IIS ver. 7 - 7.5 for profiling, follow these steps:
-
Open the Internet Information Services Manager dialog (Control Panel > Administrative Tools > Internet Information Services; Control Panel > Administrative Tools > Internet Information Services (IIS) Manager).
-
Create a virtual directory for your IIS application. To do this, right-click the Default Web Site node and select Add Virtual Directory from the context menu:
Then follow the instructions of the ensuing dialog.
-
In the Internet Information Services Manager, select your virtual directory and double-click the Handler Mappings item in the Features View.
-
Click Edit Handler Permissions (Edit Feature Permissions, in case of IIS 7.5) in the Actions pane. The Edit Handler Permissions (Edit Feature Permissions, in case of IIS 7.5) dialog appears.
-
In the dialog, check the Script and Execute options and press OK to save the changes.
-
If your IIS application includes dynamic content provided by .exe or .dll files, you need to configure ISAPI and CGI Restrictions that will enable their execution on the server. To do this:
-
In the Internet Information Services Manager, select the node corresponding to your web server (this is the top-most node in the Connections tree).
-
Double-click ISAPI and CGI Restrictions in the Features View.
-
Click Add in the Actions pane. The Add ISAPI or CGI Restriction dialog appears.
-
In the dialog:
-
Specify the full path to the .dll or .exe file in the ISAPI or CGI Path box.
-
Enter any descriptive text for the ISAPI or CGI restriction in the Description box.
-
Check Allow the extension path to execute:
-
Press OK to close the dialog and add the specified restriction.
-
-
3. Running a Profiler
Now we can profile our IIS application with AQTime:
-
Load your application in AQTime.
-
Select IIS from the Profiling Mode drop-down list box on AQTime’s Standard toolbar.Select IIS from the Profiling Mode drop-down list box on Visual Studio’s AQTime toolbar.Click the IIS button on RAD Studio’s AQTime Profiling Modes toolbar.
-
Select Run > Parameters from AQTime’s main menu.Select Profiler > Parameters from Visual Studio’s main menu.Select AQTime > Parameters from Embarcadero RAD Studio’s main menu. This will call the Run Parameters Dialog (for IIS Mode).
-
In the dialog’s Start Page edit box, you can specify the Web page that loads your IIS application. AQTime will automatically open this page in the default Internet browser once you start profiling. If you do not specify the start page in this dialog, you will have to open the desired page in Internet Explorer manually.
-
Select the desired profiler and click Run to start profiling.Select the desired profiler in the AQTime > Profiler menu item or from the Profilers box on the AQTime toolbar. Then choose AQTime > Run (or select Debug > Run while one of AQTime panels is active) to start profiling.Select the desired profiler in the AQTime > Current Profiler submenu of Embarcadero RAD Studio’s main menu and choose AQTime > Run With Profiling to start profiling.
-
AQTime will display a message box notifying you that the IISAdmin service should be restarted. Press Yes to restart the service.
-
If you do not specify the start page in the Run Parameters dialog, AQTime will wait for the start of the process that will use your DLL (IIS applications are normally DLLs). This process can be either the IIS process (inetinfo.exe) or a helper process, which the IIS uses to load your application (for example, dllhost.exe or w3wp.exe). For which process AQTime waits depends on the IIS version you use and on the Application Protection option of your IIS application.
-
To start the process, open the page that loads your IIS application, in Internet Explorer. Note that you can avoid manual opening of the page by specifying it in the Start Page edit field of the Run Parameters Dialog (for IIS Mode) dialog.
-
Now you can perform profiling as your needs dictate.
In the default configuration, IIS works as a service. It does not close when you close Internet Explorer, so AQTime does not generate any profiling results. To obtain the results, select Run > Get Results from AQTime’s menu.select AQTime > Get Results from the main menu of Visual Studio.select AQTime > Get Results from the main menu of RAD Studio. Another way to obtain the results is to create an action that will “tell” AQTime to generate the results. See Getting Results During Profiling for more information. -
To terminate the profiler run, select Run > Terminate from AQTime’s main menu or press Terminate on the Standard toolbarselect AQTime > Terminate from the main menu of Visual Studioselect AQTime > Terminate from the main menu of RAD Studio.
Samples
AQTime includes an example of IIS applications - IISSample. It demonstrates how you can profile IIS applications with AQTime. For more information on this, see Profiling IIS Applications - Tutorial. You can find the sample in the following folder:
<AQTime Samples>\Unmanaged\IISSample - Borland Delphi
See Also
Profiling Web Server Applications
Profiling IIS Applications Tutorial
Profiling ASP.NET Applications
Profiling Services
Profiling Dynamic Link Libraries