Debugging a server object extension

Debugging a server object extension (SOE) 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 SOEs. These settings are described in more detail below. You can debug .NET SOEs, with the Visual Studio debugger using the workflow described in the ArcObjects .NET SDK help.

Java SOE debugging workflow

To debug your SOE, you need to do the following:

Steps:
  1. Use ArcGIS Server Manager to deploy your SOE.
  2. Use Manager to enable debugging on your SOE and configure debugging settings. These are described in more detail below.
  3. Set breakpoints at the desired locations in your SOE code.
  4. Restart the service.
  5. Immediately attach your debugger to the operating system process running the service. If your breakpoint is in the SOE initialization code, the breakpoint will be hit as the service starts. Otherwise, the breakpoint will be hit when you use the SOE.
  6. Use Manager to disable debugging.

Configuring Java SOE debugging settings in Manager

To facilitate debugging, ArcGIS Server Manager allows you to alter SOE behavior. You can suspend the service startup so that you can attach your debugger to the service process before the SOE 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:

Steps:
  1. Log in to ArcGIS Server Manager and click Site.
  2. Click GIS Server, then in the left menu click Extensions.
  3. Click Debug Settings.
  4. Check Enable debugging of extensions.

    This enables the other options in the dialog box.

  5. Optionally, check Suspend service startup and enter the number of seconds that the service startup should be delayed.

    Some SOE 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.

  6. Optionally, specify a range of ports to be used when debugging.
  7. Click Save.

Now you can debug your extension by restarting 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 SOE's Construct method.

You can restart the service as many times as needed during the debugging process.

CautionCaution:

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.

12/18/2014