ESRI.ArcGIS.ADF.ArcGISServer.Local
MapServerDcomProxy Class
Members  Example  See Also 
ESRI.ArcGIS.ADF.ArcGISServer Namespace : MapServerDcomProxy Class




An ArcGIS Server map server proxy used when communicating with the server over DCOM.

Object Model


Syntax

Visual Basic (Declaration) 
<SerializableAttribute()>
Public Class MapServerDcomProxy 
   Inherits MapServerProxy
   Implements IETagSupportIHttpProxy 
Visual Basic (Usage)Copy Code
Dim instance As MapServerDcomProxy
C# 
[SerializableAttribute()]
public class MapServerDcomProxy : MapServerProxy, IETagSupportIHttpProxy  

Example

This example illustrates how to create a MapServerDcomProxy and call ExportMapImage to generate a new map image.
C#Copy Code
ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection connection = null; 

ESRI.ArcGIS.Server.IServerContext serverContext = null; 

  

try 



    connection = new ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection(); 

  

    connection.Host = "localhost"; 

    connection.Connect(); 

  

    ESRI.ArcGIS.Server.IServerObjectManager serverObjectManager = connection.ServerObjectManager; 

  

    serverContext = serverObjectManager.CreateServerContext("MyMapService", "MapServer"); 

  

    ESRI.ArcGIS.ADF.ArcGISServer.MapServerDcomProxy mapservice = new 

        ESRI.ArcGIS.ADF.ArcGISServer.MapServerDcomProxy(serverContext, true); 

  

    ESRI.ArcGIS.ADF.ArcGISServer.MapServerInfo mapinfo = mapservice.GetServerInfo(mapservice.GetDefaultMapName()); 

    ESRI.ArcGIS.ADF.ArcGISServer.MapDescription mapdesc = mapinfo.DefaultMapDescription; 

  

    ESRI.ArcGIS.ADF.ArcGISServer.ImageType imgtype = new ESRI.ArcGIS.ADF.ArcGISServer.ImageType(); 

    imgtype.ImageFormat = ESRI.ArcGIS.ADF.ArcGISServer.esriImageFormat.esriImagePNG; 

    imgtype.ImageReturnType = ESRI.ArcGIS.ADF.ArcGISServer.esriImageReturnType.esriImageReturnURL; 

  

    ESRI.ArcGIS.ADF.ArcGISServer.ImageDisplay imgdisp =  

        new ESRI.ArcGIS.ADF.ArcGISServer.ImageDisplay(); 

    imgdisp.ImageHeight = 500; 

    imgdisp.ImageWidth = 500; 

    imgdisp.ImageDPI = 96; 

  

    ESRI.ArcGIS.ADF.ArcGISServer.ImageDescription imgdesc =  

        new ESRI.ArcGIS.ADF.ArcGISServer.ImageDescription(); 

    imgdesc.ImageDisplay = imgdisp; 

    imgdesc.ImageType = imgtype; 

  

    ESRI.ArcGIS.ADF.ArcGISServer.MapImage mapimg = mapservice.ExportMapImage(mapdesc, imgdesc); 

  

    System.Net.HttpWebRequest webreq = System.Net.WebRequest.Create(mapimg.ImageURL) as HttpWebRequest; 

    System.Net.HttpWebResponse webresp = webreq.GetResponse() as HttpWebResponse; 

    System.Drawing.Image img = System.Drawing.Image.FromStream(webresp.GetResponseStream()); 



catch (Exception ex){} 

finally 



    serverContext.ReleaseContext(); 

    connection.Dispose(); 

}

Remarks

Asynchronous methods inherited from the Web service proxy base class are not supported over DCOM. This includes the Begin\End and Async\Completed patterns. More specifically any asynchronous method names that start with Begin or End or end with Async are not supported. Any asynchronous events that end with Completed are not supported.

Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  ESRI.ArcGIS.ADF.ArcGISServer.MapServerProxy
                     ESRI.ArcGIS.ADF.ArcGISServer.MapServerDcomProxy

See Also

© 2010 All Rights Reserved.