c#开发ArcGIS Server代码动态创建发布服务(MapServer,ImageServer)
发布日期:2021-05-10 18:18:05 浏览次数:18 分类:精选文章

本文共 4449 字,大约阅读时间需要 14 分钟。

ArcGIS Server������������MapServer

ArcGIS���������������������������������������������������������������������������������������������������������������������������������������������������MapServer���ImageServer������������������������������������������

������MapServer

private bool CreateServices(string MapPath, string ServerName)  
{
ESRI.ArcGIS.ADF.Identity identity = new ESRI.ArcGIS.ADF.Identity(MapServerUserName, MapserverPass, "");
ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection agsConnection = new ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection(HostName, identity);
agsConnection.Connect();
IServerObjectAdmin pServerObjectAdmin;
pServerObjectAdmin = agsConnection.ServerObjectAdmin;
IServerObjectConfiguration2 configuration = (IServerObjectConfiguration2)pServerObjectAdmin.CreateConfiguration();
configuration.Name = ServerName;
configuration.TypeName = "MapServer";
IPropertySet props = configuration.Properties;
props.SetProperty("FilePath", MapPath);
props.SetProperty("OutputDir", "c:\\arcgisserver\\arcgisoutput");
props.SetProperty("VirtualOutPutDir", "http://" + HostName + "/arcgisoutput");
props.SetProperty("SupportedImageReturnTypes", "URL");
props.SetProperty("MaxImageHeight", "2048");
props.SetProperty("MaxRecordCount", "500");
props.SetProperty("MaxBufferCount", "100");
props.SetProperty("MaxImageWidth", "2048");
props.SetProperty("IsCached", "false");
props.SetProperty("CacheOnDemand", "false");
props.SetProperty("IgnoreCache", "false");
props.SetProperty("ClientCachingAllowed", "true");
props.SetProperty("CacheDir", "c:\\arcgisserver\\arcgiscache\\NewService");
props.SetProperty("SOMCacheDir", "c:\\arcgisserver\\arcgiscache");
configuration.IsolationLevel = esriServerIsolationLevel.esriServerIsolationHigh;
configuration.IsPooled = true;
configuration.MaxInstances = 2;
configuration.MinInstances = 1;
IPropertySet recycleProp = configuration.RecycleProperties;
recycleProp.SetProperty("StartTime", "00:00");
recycleProp.SetProperty("Interval", "3600");
IPropertySet infoProp = configuration.Info;
infoProp.SetProperty("WebEnabled", "true");
infoProp.SetProperty("WebCapabilities", "Map,Query,Data");
pServerObjectAdmin.AddConfiguration(configuration);
pServerObjectAdmin.StartConfiguration(ServerName, "MapServer");
return true;
}

������ImageServer

private bool CreateServices(string ImagePath, string ServerName)  
{
ESRI.ArcGIS.ADF.Identity identity = new ESRI.ArcGIS.ADF.Identity(MapServerUserName, MapserverPass, "");
ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection agsConnection = new ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection(HostName, identity);
agsConnection.Connect();
IServerObjectAdmin pServerObjectAdmin;
pServerObjectAdmin = agsConnection.ServerObjectAdmin;
IServerObjectConfiguration2 configuration = (IServerObjectConfiguration2)pServerObjectAdmin.CreateConfiguration();
configuration.Name = ServerName;
configuration.TypeName = "ImageServer";
IPropertySet propertySet = configuration.Properties;
propertySet.SetProperty("Path", ImagePath);
propertySet.SetProperty("Start", "00:00");
propertySet.SetProperty("Interval", "24");
propertySet.SetProperty("SupportedImageReturnTypes", "URL");
propertySet.SetProperty("OutputDir", "c:\\arcgisserver\\arcgisoutput");
propertySet.SetProperty("VirtualOutPutDir", "http://" + HostName + "/arcgisoutput");
configuration.StartupType = esriStartupType.esriSTAutomatic;
configuration.MinInstances = 1;
configuration.MaxInstances = 2;
configuration.IsPooled = true;
IPropertySet infoProp = configuration.Info;
infoProp.SetProperty("WebEnabled", "true");
infoProp.SetProperty("WebCapabilities", "Image,Catalog,Metadata,Download,Pixels");
pServerObjectAdmin.AddConfiguration(configuration);
pServerObjectAdmin.StartConfiguration(ServerName, "ImageServer");
return true;
}

������������ArcGIS Server������������MapServer���ImageServer������������������������������������������������������������������������������ArcGIS���������������������������������������������������������������������������������MapPath���HostName���MapServerUserName���MapserverPass������������������������������������������������������������������������������������

上一篇:line string or poly boundary is self-intersecting
下一篇:ArcGIS中导入2000系的OSGB数据后发布服务,并在前端调用

发表评论

最新留言

表示我来过!
[***.240.166.169]2025年04月04日 02时55分46秒