How to debug managed-client applications that are started by using a URL in Visual Studio .NET or in Visual Studio 2005


This article describes how to use the IEExec.exe application to debug managed-client applications that you start by using a URL in Microsoft Visual Studio .NET or in Microsoft Visual Studio 2005.

back to the top

Discuss the IEExec.exe application

The IEExec.exe application is an undocumented Microsoft .NET Framework application that is included with the .NET Framework. You can use the IEExec.exe application as a host to run other managed applications that you start by using a URL.

For example, when you start a smart client by using a URL, no processes run with the smart client name. Instead, each application that you start by using a URL receives its own copy of the IEExec.exe application. The IEEXEC.exe application sets up the appropriate environment for the application to run in.

Typically, the IEExec.exe application works closely with Microsoft Internet Explorer to help you start the .NET Framework applications. The IEExec.exe application hooks to Internet Explorer version 5.01 and later to listen for assemblies that are requested. During a request, the executable is downloaded to the assembly download cache. Internet Explorer spawns a process for the IEExec.exe application and then passes the raw evidence information of the executable to the IEExec.exe application. The IEExec.exe application then uses the raw evidence information to set up an environment that has constrained-security settings for the executable.

back to the top

Use the IEExec.exe application

The following table provides information about the features that you can use in the IEExec.exe application with the .NET Framework 1.0:

Usage: ieexec.exe url flags [zone] [uniqueid]
URL to the application to start. Example: http://localhost/sample.exe
flags parameter to control execution:
0:no flags
1: create evidence for the zone only
2: create evidence for the site only
3: create evidence for both the zone and the site
If the flags indicate zone, a zone must be provided. Values can be:
0: MyComputer
1: Intranet
2: Trusted
3: Internet
4: Untrusted
5: NoZone
Unique id for the site. If the flags indicate a site, a uniqueid must be provided. Otherwise, there will be unused hex-encoded bytes. You can just use 00.

Important How you use the IEExec.exe application that is included with the .NET Framework 1.1 is different from how you use the IEExec.exe application that is included with the .NET Framework 1.0. In the .NET Framework 1.1, the IEExec.exe application only accepts the url parameter. The IEExec.exe application does not permit you to specify the zone setting and the site setting. If you try to specify the zone setting and the site setting, you receive the following error message at runtime:


back to the top

Create a Console Application project

  1. Start Microsoft Visual Basic. NET or Microsoft Visual Basic 2005. Create a Console Application project.
  2. In the Name box, type

    By default, the Module1.vb file is created.
  3. Replace the existing code in the Module1.vb file with the following code:
    Imports System
    Imports System.Security.Policy
    Imports System.Collections
    Imports System.IO
    Module Module1

    Sub Main()

    Dim myEvidence As Evidence
    myEvidence = AppDomain.CurrentDomain.Evidence
    Dim myEnumerator As IEnumerator = myEvidence.GetHostEnumerator()
    Dim i As Integer = 0
    Do While (myEnumerator.MoveNext())
    Console.WriteLine("[{0}] {1}", i + 1, myEnumerator.Current)
    End Sub
    End Module
  4. On the Build menu, click Build Solution.
  5. To create a virtual directory so that you can debug the Q822485.exe executable, follow these steps:
    1. Click Start, and then click
      Run. In the Open box, type

      The Microsoft Internet Manager Service window appears.
    2. Expand the server name.

      Note In this step, server is a placeholder for the actual name of your server.
    3. Right-click Default Web Site.
    4. Point to New, and then click
      Virtual Directory.
    5. In the Virtual Directory Creation dialog box, type DebugTest in the Alias text box.
    6. In the Web Site Content Directory dialog box, click Browse, and then locate the folder where you created Q822485.exe in step 1.

      For example, the location of the folder may be C:\Inetpub\wwwroot\Q822485\bin.
    7. Click OK.
    8. In the Access Permissions dialog box, click Next.
    9. Click Finish.
back to the top

Configure Visual Studio .NET

You must configure Visual Studio .NET to debug the Console Application project. To debug the Console Application project, you must run the Console Application project in the IEExec.exe application. To do this, follow these steps:
  1. On the View menu, click Solution Explorer to open the Solution Explorer window.

    Alternatively, you can press Ctrl+Alt+L to open the Solution Explorer window.
  2. Right-click the project, and then click
    Properties to open the Q822485 Property Pagesdialog box.
  3. In the left pane, click the Configuration Properties folder, and then click
  4. In the right pane, click Start external program, and then set Start External program to IEExec.exe.

    Typically, the IEExec.exe application is located in one of the following folders:
    • C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\ieexec.exe
    • C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ieexec.exe
  5. Specify the parameter in Command Line Arguments for IEExec.exe.

    For example, you may specify the following parameter:
    http://localhost/DebugTest/Q822485.exe 3 1 00
    Note If you are using the IEExec.exe application that is included with the .NET Framework 1.1, you can only specify the following url parameter:

  6. Set a break in your application code.
  7. On the Debug menu, click
    Start to run the application.
back to the top


For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
313892 HOW TO: Use the IEHost log to debug .NET object hosting in Internet Explorer

For additional information about code access security, visit the following Microsoft Developer Network (MSDN) Web site:
For additional information about security policy management, visit the following MSDN Web site:For additional information about the .NET Framework Configuration Tool (Mscorcfg.msc), visit the following MSDN Web site:back to the top

ID do Artigo: 822485 - Última Revisão: 13 de mai de 2008 - Revisão: 1