Tbutcher-esristaff

Debugging an SOI with Visual Studio

Blog Post created by Tbutcher-esristaff Employee on Sep 29, 2016

I just started developing an SOI for a project and instantly felt the pain in the debugging cycle.  Looking around I was not seeing much in the way of better ways to handle this.  This starting me looking at the calls that needed to be made up upload/register and enable an SOI for a service.  To handle the interaction I created a python script that allows me to handle all of the interactions.

 

  1. Update the Python Scripts (see attached) to match your variables
  2. This python uses the requests module to handle all the API call you will need to ensure it is installed
    1. Requests: HTTP for Humans — Requests 2.11.1 documentation 
  3. In the Init Section of the SOI add the System Debug Flag
    1.         public void Init ( IServerObjectHelper pSOH )

              {

                  System.Diagnostics.Debugger.Launch();

  4. In the SOI project you will need to edit the .csproj file to add a handler to run the python after a build
    1. <Target AfterTargets="RunArcGISPostPackageEvent" Name="RegisterSOI"> <Exec Command="c:\Python27\ArcGIS10.4\python.exe <PATH TO PYTHON FILE>" /> </Target>
    2. This will fire the python script each time you build your project.  
  5. Once the SOI is registered it will attempt to attach to the Visual Studio Session you have open (provided you opened as a Administrator)

Attachments

Outcomes