How to register Server object Extension using c#.net


this code will explain how to register server object extension.

How to register Server object Extension using c#.net



static void Main(string[] args)
{
//get inputCode from command line
string inputCode;

if (args.Length == 0)
{
Console.WriteLine("Press 'i' to install SOE and 'u' to uninstall");
inputCode = Console.ReadLine();
}
else
{
inputCode = args[0];
}

// Must run as an user in the agsadmin group on the SOM
IGISServerConnection conn = new GISServerConnectionClass();
conn.Connect("localhost");
IServerObjectAdmin2 soa = (IServerObjectAdmin2)conn.ServerObjectAdmin;
IServerObjectExtensionType soet = soa.CreateExtensionType();

soet.CLSID = "Editor_SOE";
soet.Description = "Server Object Extension for editing polygons";
soet.Name = "Editor_SOE";

// To delete SOE
if (inputCode == "u")
{
soa.DeleteExtensionType("MapServer", soet.Name);
Console.WriteLine("UNRegistered SOE with ArcGIS Server");
}
// To add SOE
else if (inputCode == "i")
{
soa.AddExtensionType("MapServer", soet);
Console.WriteLine("Registered SOE with ArcGIS Server");
}
else
{
Console.WriteLine("Sorry incorrect you must reopen conslole application");
}
}



Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: