Debugging ASP.NET Code with Telephony Application Simulator
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
- In Visual Studio, on the Debug menu, click Start.
- When the application starts, on the Debug menu, click Processes.
- In the Processes dialog box, in the Available Processes list box, select aspnet_wp.exe, then click Attach.
- In the Attach to Process dialog box, click OK.
- In the Processes dialog box, click Close.
To set TASim as the default Web browser
- In Visual Studio, open Solution Explorer.
- Right-click the project file and select Properties on the shortcut menu.
- In the project Property Pages dialog box, in the left pane expand the Configuration Properties menu item, and select Debugging.
- 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.
- 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
- With an ASP.NET speech application open in Visual Studio .NET 2003, in Solution Explorer right-click the speech project and select Properties.
- In the Property Pages dialog in the left pane click Configuration Properties and then Debugging.
- In the right pane under Start Action ensure that Debug Mode is set to Program. Click Apply.
- Under Start Options delete any entry in Command Line Arguments.
- Ensure that Always Use Internet Explorer is set to False, and that the path in Start Application points to TASim.exe.
- Click Apply and then click OK.
- Add breakpoints as needed in code-behind files. Add the debugger statement in .js or .pf files to open Microsoft Script Debugger.
- On the Debug menu select Start.
- 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.
- In TASim, in Start Page enter the application URL.
- In the Attach to Process dialog box, check Common Language Runtime and click OK.
- Click Close.
- 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