Dcom代理 Server

來源:互聯網
上載者:User

 

 本地串連可以使用Dcom代理,而本質上DCOM代理是利用AO對象和ArcGIS Server 伺服器對象打交道。所以本地串連,用戶端就要有AO對象,當然也可以直接利用AO API(可以認為是遠端伺服器對象的AO代理),而不使用Dcom代理,(但是使用Dcom代理,因為代理和值對象是在用戶端,所以要比AO快(AO proxies的所有操作都是在遠程調用的基礎上完成的,但是利用AO我們可以訪問到遠端的細粒度的AO對象)),而代理屬於Soap的範疇,而擷取Dcom代理,目前我發現兩種方法,如下:

 

   ESRI.ArcGIS.ADF.Identity id = new ESRI.ArcGIS.ADF.Identity(username, password, domain);

       ESRI.ArcGIS.ADF.ArcGISServer.MapServerDcomProxy mapserver_dcom =

           (MapServerDcomProxy) MapServerDcomProxy.Create(SOMname, servicename, id);

       // do something with the DCOM proxy

       mapserver_dcom.Dispose();

        

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(); 
}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.