Working with the ArcGIS Server ArcObjects API  

Overview of extending ArcGIS Server

Most developers will extend the GIS server to optimize the performance of their application. The goal of these extensions is to minimize the number of ArcObjects calls between the client application and the GIS server by encapsulating functionality in server-side components and exposing coarse-grained methods for client applications to call. There are two strategies for extending the GIS server for this purpose:

  1. Create utility COM objects

    Extending the GIS server with COM objects allows you as a developer to easily share your components across ArcGIS Server, ArcGIS Desktop and ArcGIS Engine customizations. These utility COM objects do not need to be tied to any particular server object configuration or type, and may even be used in an empty server context. This strategy does have some limitations. When extending the GIS server with a utility COM object, the object must be created new for each request made on a particular server object or server context. This means that for pooled server objects, each time a request is made on a server object, the utility COM object must be created. If the COM object has a high initialization cost, this continual creation of the object may be prohibitive. Because the COM object is created for each request, you can't use it to cache information as its used.

    Samples: ArcGIS_Spatial_Query_COM_Utility

  2. Create server object extensions

    A server object extension is created and initialized at the time the server object instance itself is created and is re-used at the request level, like the server object itself. So, if the server object extension is costly to initialize, that cost is paid only once when the server object instance is created. Also, since an instance of a server object extension remains alive as long as the server object instance its extending is alive, its able to cache information that can be re-used from request to request. Server object extensions are tied to a particular server object configuration or type and can't be used in an add-hoc fashion like a utility COM object.

    Samples: ArcGIS_Spatial_Query_Server_Object_Extension, ArcGIS_Simple_Server_Object_Extension
    Scenarios: Creating a Server Object Extension 

The GIS server can easily be extended to use application-specific COM objects that a developer can write in VB, C++, or .NET. If these COM components are installed on the server object container machines on which your server objects are hosted, then they can be used to do work for your application.

Note: If your application makes fine-grained use of ArcObjects, it's not necessary to always extend the server or a server object. As discussed above, it comes down to the volume of those calls that your application will make. If your application is written in such a way that it always makes thousands of fine-grained ArcObjects calls, or the number of fined-grained calls is indeterminate based on user interaction with the application, you should consider moving some of the code into the server. If you design your application such that large volumes of fine-grained ArcObjects calls are not necessary, and your user interface is designed such that your users cannot make requests that result in a large volume of fine-grained ArcObjects calls, then extending the server using either of these techniques is not necessary.

The following is a summary of the different ArcObjects extensions that can be used in the GIS Server:

Server COM objects and .NET

You can develop utility COM objects in any COM language, specifically, VB, C++, or .NET. A server object extension, which is implemented as a COM object, can be developed in C++ or .NET. When using .NET to create a COM object for use in the GIS server (either utility COM objects or server object extensions), there are some specific guidelines you need to follow to ensure that you can use your object in a server context and that it will perform well in that environment. For an overview of how to create a COM object using .NET, refer to the .NET and ArcGIS topic. The guidelines below apply specifically to COM objects you create to run within the server.

Registering extensions

To use an ArcObjects extension with ArcGIS Server for .NET, the extension COM object must be registered on all the GIS server's container machines, and any appropriate component categories. Once this is done, the extension become available to any server application.

To register utility COM objects and server object extensions, some additional registration steps need to be taken. For more information, refer to the Application performance tuning section.