Condividi tramite


Debugging ASP.NET Code with Telephony Application Simulator

  Microsoft Speech Technologies Homepage

Visual Basic and C# code in ASP.NET Web applications is contained in code-behind pages with .vb or .cs filename extensions. The debugger attaches to the TASim.exe process by default when a voice-only application opens in debug mode. To allow code debugging on a code-behind page, it is necessary to attach to the aspnet_wp.exe process.

There are two ways to attach to this process. The choice of method likely depends on whether breaking into the Load event handler on the first-loaded page is required. The following table summarizes the advantages of the two methods, with procedures for both methods following the table.

Method Advantage
Manually attach to aspnet_wp.exe Leaves Internet Explorer as the default Web browser, rather than setting the default as Telephony Application Simulator (TASim).
Set TASim as the default Web browser This method is quicker and easier to use since the steps do not need to be redone each time the application is run; and it allows breakpoints in the Load event handler on the first-loaded page.

To manually attach to aspnet_wp.exe

  1. In Visual Studio, on the Debug menu, click Start.
  2. When the application starts, on the Debug menu, click Processes.
  3. In the Processes dialog box, in the Available Processes list box, select aspnet_wp.exe, then click Attach.
  4. In the Attach to Process dialog box, click OK.
  5. In the Processes dialog box, click Close.

To set TASim as the default Web browser

  1. In Visual Studio, open Solution Explorer.
  2. Right-click the project file and select Properties on the shortcut menu.
  3. In the project Property Pages dialog box, in the left pane expand the Configuration Properties menu item, and select Debugging.
  4. For a Visual Basic .NET project, in the right pane select Start Project, and ensure that Always use Internet Explorer when debugging Web pages is not selected. For a C# project, in the right pane set Debug Mode to Project, and set Always use Internet Explorer to False. Click OK.
  5. On the File menu, select Browse With. In the Browse With dialog box, select TASim.exe, click Set As Default, and click Close.

Debugging Client and Server-Side Code Simultaneously

Speech applications contain code that runs on both the client and server. There is a need to debug code at both locations. Use the following procedure to debug both client and server code simultaneously, in the same debugger.

To debug client and server code simultaneously

  1. With an ASP.NET speech application open in Visual Studio .NET 2003, in Solution Explorer right-click the speech project and select Properties.
  2. In the Property Pages dialog in the left pane click Configuration Properties and then Debugging.
  3. In the right pane under Start Action ensure that Debug Mode is set to Program. Click Apply.
  4. Under Start Options delete any entry in Command Line Arguments.
  5. Ensure that Always Use Internet Explorer is set to False, and that the path in Start Application points to TASim.exe.
  6. Click Apply and then click OK.
  7. Add breakpoints as needed in code-behind files. Add the debugger statement in .js or .pf files to open Microsoft Script Debugger.
  8. On the Debug menu select Start.
  9. In Visual Studio .NET 2003, on the Debug menu select Processes. In the Processes dialog box, select either aspnet_wp.exe or w3wp.exe, and click Attach.
  10. In TASim, in Start Page enter the application URL.
  11. In the Attach to Process dialog box, check Common Language Runtime and click OK.
  12. Click Close.
  13. In TASim, click Dial.

The debugger will stop at breakpoints in the code behind file first, since the debugger is attached to aspnet_wp.exe. Once the page is rendered, the debugger will stop at the debugger statement in the client side code as well, since by default the debugger is attached to TASim.

See Also

Debugging Speech Applications | Debugging the Tutorial Application