ArcGIS创建发布地图服务
2014-12-31 15:42
405 查看
#region 创建地图服务 private bool CreateServices(string MapPath, string ServerName)//ServerName为地图服务设置的服务名 { ESRI.ArcGIS.ADF.Identity identity = new ESRI.ArcGIS.ADF.Identity(MapServerUserName, MapserverPass, "");//MapServerUserName和MapserverPass为连接ArcGIS Server的用户名和密码 ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection agsConnection = new ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection(HostName, identity);//HostName为ArcGIS Server所在服务器的主机名 agsConnection.Connect(); IServerObjectAdmin pServerObjectAdmin; pServerObjectAdmin = agsConnection.ServerObjectAdmin; IServerObjectConfiguration2 configuration = (IServerObjectConfiguration2)pServerObjectAdmin.CreateConfiguration(); configuration.Name = ServerName;//发布Service的名称,必填 configuration.TypeName = "MapServer";//发布服务的类型,如:MapServer,GeocodeServer IPropertySet props = configuration.Properties; props.SetProperty("FilePath", MapPath);//设置MXD的路径 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");//som的切片输出路径 //configuration.Description = "NewService";//Service的描述 configuration.IsolationLevel = esriServerIsolationLevel.esriServerIsolationHigh;//或者esriServerIsolationLow,esriServerIsolationAny configuration.IsPooled = true;//是否池化 configuration.MaxInstances = 2;//最多的实例数 configuration.MinInstances = 1;//最少的实例数 ////设置刷新 IPropertySet recycleProp = configuration.RecycleProperties; recycleProp.SetProperty("StartTime", "00:00");//刷新开始时间 recycleProp.SetProperty("Interval", "3600");//刷新间隔 ////设置是否开启REST服务 IPropertySet infoProp = configuration.Info; infoProp.SetProperty("WebEnabled", "true");//是否提供REST服务 infoProp.SetProperty("WebCapabilities", "Map,Query,Data");//提供何种服务 //configuration.StartupType = esriStartupType.esriSTAutomatic;//或者esriSTManual //configuration.UsageTimeout = 120;//客户端占用一个服务的最长时间 //configuration.WaitTimeout = 120;//客户端申请一个服务的最长等待时间 #endregion //添加服务到Server pServerObjectAdmin.AddConfiguration(configuration); //启动服务 pServerObjectAdmin.StartConfiguration(ServerName, "MapServer");//设置服务类型为MapServer,并启动服务 return true; } #endregion
相关文章推荐
- ArcGIS10.1 发布并使用地图服务
- 【转】从ArcGIS for Desktop 发布地图服务
- arcgis开发笔记【silverlight 发布rest地图服务】
- ArcGIS地图服务发布步骤
- 发布完ArcGIS地图服务后,服务未启动成功
- ArcGISServer 发布地图服务 后在ArcGIS Service Directory中看不到
- 在ArcGIS中发布GoogleEarth瓦片为网络地图服务(wms)
- 动态创建地图文档MXD并发布地图服务
- arcgis 10.1 导入数据到oracle 发布地图服务
- ArcGIS发布地图服务后直接调用查看方法
- 天地图应用ArcGIS发布的服务
- 使用Python创建.sd服务定义文件,实现脚本自动发布ArcGIS服务
- Arcgis for Server 服务器发布地图服务
- ArcGIS发布地图服务
- 关于arcgis for android demo中加载自己发布的地图服务出错
- ArcGIS 10.2之 地图服务的发布、使用
- arcgis for flex 地图发布服务
- 通过Python脚本创建ArcGIS地图服务缓存
- 【转】从 ArcGIS for Desktop 发布地图服务
- 天地图应用ArcGIS发布的服务(转)