Compartir a través de


Voice Response Application Authoring Notes

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Study the following notes prior to developing voice response applications.

Designer-Managed Form Code

The Workflow Designer uses the partial keyword to divide the implementation of VoiceResponseWorkflow1 into two separate files, as shown in the following table.

File (C# File Name) Function

VoiceResponseWorkflow1.cs

Main class file

VoiceResponseWorkflow1.designer.cs

Designer-emitted code

This separation allows author's code to be kept separate from designer-emitted code. Designer-emitted code is code that Workflow Designer writes when an author uses a drag-and-drop operation to move controls or edits values in the Properties window. Typically, authors should not edit code in the VoiceResponseWorkflow1.designer.cs file.

This separation is enabled by support in .NET Framework 2.0 for partial classes. For more information, see Partial Class Definitions (C# Programming Guide).

Editing Code in VoiceResponseWorkflow1.designer.cs

The VoiceResponseWorkflow1.designer.cs file contains code that Workflow Designer uses to implement author actions, such as moving controls with a drag-and-drop operation and setting properties in the Properties window. Because this code is used by Workflow Designer, authors should not edit it. Further, because this code is interpreted rather than executed at design time and any code that authors leave might be overwritten, manually adding or modifying code is not recommended.

.Speax File

The .speax file is created by the Voice Response Web Application Project Wizard and stores references to the application assembly.

Remoting

When creating a remoting channel in the primary application domain in which the application runs by default, ensure that the remoting channel does not conflict with channels used by the Speech Server runtime. If possible, use the TCP server channel already created by Speech Server. If it is necessary to create a TCP server channel, it must be a TCP server channel with authentication but not encryption-enabled, the priority must be set higher than 10, and the channel must not be shut down until the server is stopped. If a different type of channel is required, open it in a new application domain specific to the application.

Closed Event

SpeechSequentialWorkflowActivity

The SpeechSequentialWorkflowActivity class Closed event is not called. Instead, add an event handler for the WorkflowRuntime.WorkflowCompleted event.

Activities Contained in a SpeechSequenceActivity

For speech activities contained in a SpeechSequenceActivity, Closed event handlers must be added at run time after the containing activity is added to the main workflow. The easiest way to do this is to add the event handler to a Code activity placed in the SpeechSequenceActivity.

Executing Event

Many of the classes in the Dialog namespace have an Executing event, which is inherited from System.Workflow.ComponentModel.Activity. If you write an event handler for the Executing event, the best practice is to use exception handling in your handler. The reason for this practice is that if multiple exceptions occur, only the most recent exception is available in the application's exception handler.

Suppose you have written an Executing handler for a QuestionAnswerActivity and the last statement in the handler sets the contents of the main prompt. If an exception occurs before the last statement executes, the application exception handler informs you only that the QuestionAnswerActivity is missing a main prompt, without any information about why the first exception occurred.

One way to determine the cause of the first exception is by stepping through the code in your handler until an exception is thrown.

A less time-consuming approach is to insert the code in your handler in a try block and use one or more catch blocks to catch specific exceptions. In this way, you can process any exceptions at the time they are thrown.

GoToActivity Target

The target of a GoToActivity must be a child of an ancestor (parent, grandparent, great-grandparent, and so on) of the GoToActivity. In addition, the ancestor must be a SpeechSequenceActivity or one of its derived classes (CommandActivity, SpeechEventActivity, or SpeechSequentialWorkflowActivity). For more information, see GoToActivity.

See Also

Concepts

Writing Secure Code
Limitations When Using a TIM

Other Resources

Create Managed Code Voice Response Applications
Speech Application Development Guide
Speech Server Tutorials
Walkthroughs for Managed Code Voice Response Applications