C#+engine调用gisserver地图服务出现“通用服务器错误消息”

惜墨儿 2014-03-03 10:07:36
IAGSServerConnectionFactory connectionFactory = new AGSServerConnectionFactory();
IPropertySet propertySet = new PropertySetClass();
IAGSServerConnection connection = null;

propertySet.SetProperty("url", "http://localhost/ArcGIS/services");

connection = connectionFactory.Open(propertySet, 0);

//获取MapService对象
IAGSEnumServerObjectName serverObjectNames;
IAGSServerObjectName serverObjectName;
serverObjectNames = connection.ServerObjectNames;
while ((serverObjectName = serverObjectNames.Next()) != null)
{
if (serverObjectName.Name.Equals(lyrName) && serverObjectName.Type.Equals("MapServer"))
break;
}

if (serverObjectName == null)
{
//WaitForm.Close();
MessageBox.Show("无法连接远程地图数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;

}

IName name = serverObjectName as IName;
mapServer = name.Open() as IMapServer;
IMapServerLayer layer = new MapServerLayer() as IMapServerLayer;
layer.ServerConnect(serverObjectName, mapServer.DefaultMapName);

axMapControl1.AddLayer(layer as ILayer);

axMapControl1.Refresh();

}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
//WaitForm.Close();

}
在 connection = connectionFactory.Open(propertySet, 0);处出现“通用服务器错误消息”,实在不知道是什么原因,哪位知道的帮帮忙啊
...全文
94 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
zm03173225 2014-03-03
  • 打赏
  • 举报
回复
http://localhost/ArcGIS/services这个直接网页打开能看到服务吗 是什么版本的engine

110,565

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧