Local (DCOM) connections are only supported for ArcGIS Server versions prior to 10.1.
Limiting the size of query results
The Geodatabase library includes objects that allow you to query data in a database using spatial filters, attribute filters, or a combination of the two. At this level of the ArcObjects API, no limits or constraints are put on the nature of the query or the number of records that can be returned by the cursor resulting from executing the query. If, for example, a Web application executes a query that returns 1,000,000 rows and iterates through each row, this can (depending on the nature of the query) tie up the database server while the query is evaluated, then tie up the Web server as the application iterates through the 1,000,000 rows.
You can avoid this type of query by not allowing users to perform ad hoc queries against the database. Design your application to control the types of queries that users can execute (or that are executed as a result of their interaction with the application). Also, set limits on the number of query results that the application processes for those cases where a large number of query results are returned from the database. You can do this by evaluating a fixed number of maximum rows from result cursors.
The following code example shows how to execute a query that returns a cursor with a large number of records. In this example, the application stops evaluating the cursor after the first 100 rows have been retrieved. Assume that pFeatureClass is a feature class in the server context.
[C#]
IQueryFilter pQueryFilter = pServerContext.CreateObject(
"esriGeodatabase.QueryFilter");
pQueryFilter.WhereClause = "ObjectID > 100";
ICursor pCursor = pFeatureClass.Search(pQueryFilter, true);
long i = 0;
i = 1;
IFeature pFeature = pCursor.NextRow();
while (pFeature != null & i < 100)
{
// Do something with the feature.
i = i + 1;
Set pFeature = pCursor.NextRow();
}
[VB.NET]
Dim pQueryFilter As IQueryFilter = pServerContext.CreateObject("esriGeodatabase.QueryFilter")
pQueryFilter.WhereClause = "ObjectID > 100"
Dim pCursor As ICursor = pFeatureClass.Search(pQueryFilter, True)
Dim i As Long
i = 1
Dim pFeature As IFeature = pCursor.NextRow()
While Not pFeature Is Nothing And i < 100
' Do something with the feature.
i = i + 1
Set pFeature = pCursor.NextRow()
End While
Maximum record count
There are cases where, when using the coarse-grained methods on the MapServer, queries can be executed, but the execution and evaluation of the query takes place in the MapServer. For example, the QueryFeatureData method on IMapServer returns a fully populated record set containing the results of the query. To ensure that these record sets do not contain a number of rows too large for the system to handle, the MapServer has built-in limits to evaluate the results of a query to a maximum record count (logically the same as previously shown).
This maximum is set as a property of the MapServer object called MaxRecordCount. By default, the MaxRecordCount is 500, but this property can be modified by the administrator of the geographic information system (GIS) server by changing the value of the MaxRecordCount Extensible Markup Language (XML) tag in the MapServer configuration file. For more information on the GIS server configuration files and how to modify them see the section titled "Working with configuration files" in the ArcGIS Server Manager help system under Creating ArcGIS for Server solutions > Managing your GIS server > Administering ArcGIS for Server > Tuning and configuring ArcGIS for Server.
The maximum record count is applied to the results of the following methods on IMapServer:
- QueryFeatureData
- Find
- Identify
Maximum buffer count
MapServer also allows you to dynamically draw buffers around features by specifying a SelectionBufferDistanceProperty on ILayerDescription that is greater than zero. If the selection is large, this can increase the resources required to draw a map. MapServer also has built-in limits to control the number of features that can be buffered per layer.
This maximum is set as a property of the MapServer object MaxBufferCount. By default, MaxBufferCount is 100, but this property can be modified by the administrator of the GIS server by changing the value of the MaxBufferCount XML tag in the MapServer configuration file.
Maximum result size
GeocodeServer has built-in limits that prevent requests from returning results that are too large. Specifically, the number of records returned by the FindAddressCandidates method is limited by the GeocodeServer MaxResultSize property. The default is 500, but this property can be modified by the administrator of the GIS server by changing the value of the MaxResultSize XML tag in the GeocodeServer configuration file.
Maximum batch size
The GeocodeServer also has a built-in limit for the number of input records that can be passed into the GeocodeAddresses method. This maximum is set as a property of GeocodeServer called MaxBatchSize and can be modified by the administrator of the GIS server by changing the value of the MaxBatchSize XML tag in the GeocodeServer configuration file.
Limiting the size of output
Another instance that needs to be monitored is when your application writes output to a server directory. Large files take significant amounts of disk space and resources to produce. Take this into consideration when writing your files.
The MapServer ExportMapImage method takes an ImageDescription object that includes the size of the image requested. To limit the size of images produced by ExportMapImage, MapServer has built-in limits for the size of images that ExportMapImage can produce. This maximum is set as two properties of the MapServer object, MaxImageWidth and MaxImageHeight, specified in pixels. By default, these are set to 2048, but these properties can be modified by the administrator of the GIS server by changing the values of the MaxImageWidth and MaxImageHeight XML tags in the MapServer configuration file.