Local connections can use the DCOM proxy, but essentially DCOM Proxy is used AO Object and ArcGIS Server Server objects. Therefore, for local connection, the client must have an AO object. Of course, you can also directly use the ao api (which can be considered as the AO proxy of the Remote Server Object) without using the DCOM proxy, (But using DCOM proxy, because the proxy and value object are on the client, it is faster than AO (AO proxiesAll operations inRemote CallBut with AO, we can access the remote fine-grained AO object.), And the proxy belongs to the scope of soap and obtains the DCOM proxy. Currently, I have found two methods:
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. getdefamapmapname ()); 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 (); } |