ArcGIS Simple Server Object Extension
ArcGIS_Simple_Server_Object_Extension_VBNet\RegisterSOE\Program.vb
' Copyright 2009 ESRI
' 
' All rights reserved under the copyright laws of the United States
' and applicable international laws, treaties, and conventions.
' 
' You may freely redistribute and use this sample code, with or
' without modification, provided you include the original copyright
' notice and use restrictions.
' 
' See the use restrictions.
' 


Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports ESRI.ArcGIS.Server
Imports ESRI.ArcGIS.ADF.Connection.AGS

Namespace RegisterSOE
  Friend Class Program
    Shared Sub Main(ByVal args() As String)
      ' Must run as an user in the agsadmin group on the SOM
      Dim gisconnection As New AGSServerConnection()
      gisconnection.Host = "localhost"
      gisconnection.Connect()
      Dim soa As IServerObjectAdmin2 = CType(gisconnection.ServerObjectAdmin, IServerObjectAdmin2)
      Dim soet As IServerObjectExtensionType2 = CType(soa.CreateExtensionType(), IServerObjectExtensionType2)

      soet.CLSID = "SimpleSOE_VBNet.UtilSOE_VBNet"
      soet.Description = "Simple Server Object Extension VBNet"
      soet.Name = "SimpleSOE_VBNet"
      soet.DisplayName = "Simple SOE VBNet"

      ' To delete SOE
      'soa.DeleteExtensionType("MapServer", soet.Name);
      'Console.WriteLine("UNRegistered SOE with ArcGIS Server");

      ' To add SOE
      soa.AddExtensionType("MapServer", soet)
      Console.WriteLine("Registered SOE with ArcGIS Server")

      Console.ReadLine()
    End Sub
  End Class
End Namespace