This topic describes the debugging workflow for server object extensions (SOEs) and server object interceptors (SOIs), and how to attach the Visual Studio debugger.
Debugging an extension (SOE or SOI) poses certain challenges, because you must step into a running service process. Visual Studio provides different ways of attaching the debugger to a process, including remote debugging. The workflow for debugging extensions is the same for .NET SOE and SOI. To debug your extension, do the following:
- Use ArcGIS Server Manager to deploy extensions.
- Place breakpoints at the desired locations in the extension code.
- Enable extensions with a service and restart the service.
- Attach the Visual Studio debugger to the running service process.
- Perform corresponding service operations to hit the breakpoint and step through the code.
To debug an SOE or SOI with a running service instance, the extension must be deployed on ArcGIS Server and enabled with a service first. If you would like to modify the code during debugging, you have to rebuild the extension project, update the extension on ArcGIS Server, and then reenable it with a service, repeating the above steps 1 through 5. Therefore, it's highly recommended that the extension code with business logic be tested on a local project for unit testing first and then tested with a service, as this will reduce the work of debugging the extension on ArcGIS Server.
The rest of this topic mainly discusses step 4, Attach the Visual Studio debugger to debug the SOI with a running service process. Prerequisite knowledge of deploying extensions and enabling extensions is required before you continue this topic.
If ArcGIS Server is installed on the same machine as Visual Studio, there are two different ways of attaching the debugger, and you may either automatically attach the Visual Studio debugger or manually attach the Visual Studio debugger to the service process. If ArcGIS Server is not installed on the same machine as Visual Studio, you need to follow the instructions for remotely debug extensions in Visual Studio.