如何采用Local方式连接到ArcGIS Server

在使用ArcGIS Server ArcObjects API的时候,一般都需要首先以local方式连接到GIS Server,那么在9.2版本中有两个类可以连接到GIS Server。一个是ESRI.ArcGIS.Server.GISServerConnectionClass类,另一个是ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection类。

ESRI.ArcGIS.Server.GISServerConnectionClass类是对COM类封装以后的.NET类,在连接GIS Server时没有显式的指定用户,那么连接GIS Server是使用的是什么用户呢?其实是使用的web应用的用户,如果在web.config中有identity的节点,那么就是它了。连接的代码如下:

[C#]
ESRI.ArcGIS.Server.GISServerConnectionClass gisconnection;
gisconnection = new ESRI.ArcGIS.Server.GISServerConnectionClass();
gisconnection.Connect("servername");
ESRI.ArcGIS.Server.IServerObjectManager som = gisconnection.ServerObjectManager;

ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection类是一个纯粹的.NET类,其实整个ESRI.ArcGIS.ADF.Connection类库中的类都是.NET类。我们在连接server时最好使用AGSServerConnection。这个类需要显式的指定身份信息,用法如下:

[C#]
ESRI.ArcGIS.ADF.Identity identity = new ESRI.ArcGIS.ADF.Identity("user", "passwd", "domain");
ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection agsconnection;
agsconnection = new ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection("hostname", identity);
agsconnection.Connect();
IServerObjectManager som = agsconnection.ServerObjectManager;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值