Debugging an extension
In this topic
Note:
Server object interceptors (SOIs) are a new feature at 10.3.1. Information in this topic about SOIs only applies to 10.3.1.
Debugging an extension (SOE or SOI) can pose certain challenges because you must step into a running service process. ArcGIS Server Manager offers several settings that can help you debug Java extensions. These settings are described in more detail below. You can only debug .NET extensions with the Visual Studio debugger; no Manager debugging tool exists for .NET extensions. The ArcObjects .NET SDK help contains instructions on how to debug .NET extensions.
Debugging workflow
To debug your extension, you need to do the following:
- Use ArcGIS Server Manager to deploy your extension.
- Use Manager to enable debugging on your extension and configure debugging settings. These are described in more detail below.
- Set breakpoints at the desired locations in your extension code.
- Stop and then start the service.
- Immediately attach your debugger to the operating system process running the service. If your breakpoint is in the extension initialization code, the breakpoint will be hit as the service starts. Otherwise, the breakpoint will be hit when you use the extension.
- Use Manager to disable debugging.
Configuring debugging settings in Manager
To facilitate debugging, ArcGIS Server Manager allows you to alter extension behavior. You can suspend the service startup so that you can attach your debugger to the service process before the extension initialization methods are called. You can also specify a range of ports that will be used when debugging the service.
To access these debugging settings in Manager, follow these steps:
- Log in to ArcGIS Server Manager and click Site.
- Click GIS Server > Extensions.
- Click Debug Settings and check Enable debugging of extensions. This enables the other options in the dialog box.
- Optionally, check Suspend service startup and enter the number of seconds that the service startup should be delayed.
Some extension code only runs one time, when the service starts. This code is typically placed in the Construct method of the IObjectConstruct interface. Suspending the service startup gives you time to attach your debugger to the service process before the Construct method runs, thereby allowing you to hit any breakpoints you have set in that method's code.
- Optionally, specify a range of ports to be used when debugging.
- Click Save.
Now you can debug your extension by stopping and then starting the service and attaching your debugger to the operating system process running your service. If you set a time window for suspending service startup, you need to attach your debugger to the service process before this window is reached; otherwise, you will not hit any breakpoints in the extension's Construct method.
You can stop and start the service as many times as needed during the debugging process.
Caution:
When you have finished debugging your extension, return to the debug settings and uncheck Enable debugging of extensions. If you fail to do this and you had configured your settings to suspend the service startup, you will experience a delay each time you try to start your service.