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);处出现“通用服务器错误消息”,实在不知道是什么原因,哪位知道的帮帮忙啊