http://dkay.blogbus.com/logs/47727282.html

protected void Button14_Click(object sender, EventArgs e)
    {
        IGISServerConnection pGISServerConnection;
        pGISServerConnection = new GISServerConnectionClass();

        //请注意:connect输入的主机名,表示要连接的服务器
        pGISServerConnection.Connect("superzhang");

        IServerObjectAdmin pServerObjectAdmin;
        pServerObjectAdmin = pGISServerConnection.ServerObjectAdmin;

        IServerObjectConfiguration2 configuration = (IServerObjectConfiguration2)pServerObjectAdmin.CreateConfiguration();
        configuration.Name = "NewService";//发布Service的名称,必填
        configuration.TypeName = "MapServer";//发布服务的类型,如:MapServer,GeocodeServer

        IPropertySet props = configuration.Properties;
        props.SetProperty("FilePath", @"D:\gis data\world.mxd");//设置MXD的路径

        //一下的property并非必须,只要一个filepath就可以发布
        props.SetProperty("OutputDir", "c:\\arcgisserver\\arcgisoutput");//图片的输出目录
        props.SetProperty("VirtualOutPutDir", "http://superzhang:8399/arcgis/server/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 = 1;//最多的实例数
        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;//客户端申请一个服务的最长等待时间

        //添加服务到Server
        pServerObjectAdmin.AddConfiguration(configuration);

        //启动服务
        pServerObjectAdmin.StartConfiguration("NewService", "MapServer");

   }

最新文章

  1. 7个高性能JavaScript代码高亮插件
  2. 廖雪峰教程笔记:js中map和reduce的用法
  3. C# 退出程序方法
  4. C# 生成XML空元素/空节点自动换行解决方案
  5. C# 生成二维码,彩色二维码,带有Logo的二维码及普通条形码
  6. Effective C++ 4.设计与声明
  7. 如何在安装32位Oracle客户端组件的情况下以64位模式运行
  8. 无法创建spool文件
  9. 安卓模拟器BlueStacks 安装使用教程(图解)
  10. SecureCRT中文显示乱码的解决方法
  11. new到底做了什么?
  12. jQuery常用的查找Dom元素方法
  13. ant基础[转]
  14. git初试
  15. Redo丢失的4种情况及处理方法
  16. Javascript - DOM文档对象模型
  17. 记一次python的任务调度模块apscheduler只在首次执行任务的情况
  18. github帐户和仓库的创建
  19. 分布式监控系统Zabbix-3.0.3-完整安装记录
  20. Volley框架原理

热门文章

  1. selelinum+PhantomJS 爬取拉钩网职位
  2. JS 中的事件绑定、事件监听、事件委托是什么?
  3. v8引擎详解
  4. luogu P1462 通往奥格瑞玛的道路--spfa+二分答案
  5. Thinkphp框架图片上传实例
  6. jdk环境变量配置至第一个简单程序运行成功
  7. InnoDB INFORMATION_SCHEMA Temporary Table Info Table
  8. KVM中的网络简介(qemu-kvm)
  9. 南邮CTF--SQL注入题
  10. Wall Treatment