ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection连接服务器时报错:没有注册类
代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection agsServerConnection = new ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection();
agsServerConnection.Host = "10.16.4.165";
agsServerConnection.Connect();
//ESRI.ArcGIS.ADF.Identity identity = new ESRI.ArcGIS.ADF.Identity("Administrator", "1234", "10.16.4.165");
//ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection gisServerConnection;
//gisServerConnection = new ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection("10.16.4.165", identity);
//gisServerConnection.Connect();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection agsServerConnection = new ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection();
agsServerConnection.Host = "10.16.4.165";
agsServerConnection.Connect();
//ESRI.ArcGIS.ADF.Identity identity = new ESRI.ArcGIS.ADF.Identity("Administrator", "1234", "10.16.4.165");
//ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection gisServerConnection;
//gisServerConnection = new ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection("10.16.4.165", identity);
//gisServerConnection.Connect();
}
}
}
1 个回复
朱新颖
赞同来自: GIS知乎 、胡会敏
IPropertySet propertySet = new PropertySetClass();
propertySet.SetProperty("url", host);
propertySet.SetProperty("ConnectionMode", esriAGSConnectionMode.esriAGSConnectionModeAdmin);
propertySet.SetProperty("ServerType", esriAGSServerType.esriAGSServerTypeDiscovery);
propertySet.SetProperty("user", username);
propertySet.SetProperty("password", password);
propertySet.SetProperty("ALLOWINSECURETOKENURL", true); //设置为false会弹出一个警告对话框
IAGSServerConnectionName3 pConnectName = new AGSServerConnectionNameClass() as IAGSServerConnectionName3;//10.1新增接口
pConnectName.ConnectionProperties = propertySet;
IAGSServerConnectionAdmin pAGSAdmin = ((IName)pConnectName).Open() as IAGSServerConnectionAdmin;
IServerObjectAdmin pServerObjectAdmin = pAGSAdmin .ServerObjectAdmin;
要回复问题请先登录或注册