Debugging a Custom Component

To call a custom component that is hosted by Notification Services, you must build and run a Notification Services application that calls the component. You cannot use this method to debug a non-hosted event provider, because they are not hosted by the Notification Services engine.

If Notification Services is running as the NS$instanceName Microsoft Windows service, you can start the service and attach a debugger to the running process, which is NSService.exe. If more than one instance is running, there are multiple NSService.exe processes running.

Alternatively, you can run the Notification Services engine as a console application to debug application components in Microsoft Visual Studio .NET. To do this, follow these steps:

  1. In Visual Studio .NET, right-click the project containing the custom component, click Properties, and then click Debug.
  2. In the Start Action section, select Start external program, and then type the fully-qualified path to NSService.exe. The default location for this file is C:\Program Files\Microsoft SQL Server\90\NotificationServices\9.0.242\bin\.
  3. In the Start Options section, type the following in the Command Line Arguments box:
    *     instanceName*-a
    instanceName is the name of the instance you want to debug, without the NS$ prefix. The -a argument specifies to run the service as a console application. For example, you would enter Tutorial -a for the Tutorial instance.
  4. Place a breakpoint in the custom component code wherever you want the debugger to stop.
  5. Start the solution.
  6. Drop events into the system, so that the application starts processing.

See Also

Other Resources

Developing Custom Notification Services Components

Help and Information

Getting SQL Server 2005 Assistance