ArcGIS for Desktop

  • 文档
  • 合约
  • 支持

  • My Profile
  • 帮助
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

专为贵组织打造的制图平台

ArcGIS for Desktop

全面的专业性 GIS

ArcGIS for Server

面向企业的 GIS

ArcGIS for Developers

用于构建位置感知应用程序的工具

ArcGIS Solutions

适用于行业的免费模板地图和应用程序

ArcGIS Marketplace

获取适用于组织的应用程序和数据

  • 文档
  • 合约
  • 支持
Esri
  • 登录
user
  • 我的个人资料
  • 登出

帮助

  • 主页
  • 入门
  • 制图
  • 分析
  • 管理数据
  • 工具
  • 更多...

DeleteMapService

  • 摘要
  • 讨论
  • 语法

摘要

法律声明:

此方法自 ArcGIS 10.1 for Server 和 ArcGIS 10.1 for Desktop 起已弃用并会返回运行时错误。有关新的 ArcGIS for Server Administrator API 的使用方法,请查阅 ArcGIS 文档。

从指定的 ArcGIS for Server 中删除地图服务。

讨论

此方法自 ArcGIS 10.1 for Server 和 ArcGIS 10.1 for Desktop 已弃用并会返回运行时错误。

ArcGIS 10.1 for Server 具有全新架构,这种架构可能要求您调整服务器的使用方式。有关详细信息,请参阅以下帮助主题:迁移至 ArcGIS for Server 时可能出现的情况。

您可以使用 ArcGIS 站点目录中的 ArcGIS for Server Administrator API 删除地图服务。ArcGIS for Server 站点目录的默认 URL 如下所示:

http://<服务器名称>:6080/arcgis/admin

注:

如果您已将 ArcGIS for Server Web Adaptor 配置为与您的站点配合使用,则 Site Directory 的 URL 可能会有所不同。例如,可能不需要端口号 6080。检查 Web Adaptor 配置以获得正确的 URL。

下面演示了使用 Python 和 ArcGIS for Server Administrator API 删除地图服务:

import json
import urllib
import urllib2

def gentoken(url, username, password, expiration=60):
    query_dict = {'username':   username,
                  'password':   password,
                  'expiration': str(expiration),
                  'client':     'requestip'}
    query_string = urllib.urlencode(query_dict)
    return json.loads(urllib.urlopen(url + "?f=json", query_string).read())['token']

def deleteservice(server, servicename, username, password, token=None, port=6080):
    if token is None:
        token_url = "http://{}:{}/arcgis/admin/generateToken".format(server, port)
        token = gentoken(token_url, username, password)
    delete_service_url = "http://{}:{}/arcgis/admin/services/{}/delete?token={}".format(server, port, servicename, token)
    urllib2.urlopen(delete_service_url, ' ').read() # The ' ' forces POST
    
# if you need a token, execute this line:
deleteservice("<server>", "<service>.MapServer", "<admin username>", "<admin password>")

# if you already have a token, execute this line:
deleteservice("<server>", "<service>.MapServer", None, None, token='<token string>')

语法

DeleteMapService (connection_url_or_name, server, service_name, {folder_name}, {connection_username}, {connection_password}, {connection_domain})
参数说明数据类型
connection_url_or_name

A string that represents the URL of the ArcGIS for Server for which you want to delete a service.

String
server

A string that represents the ArcGIS for Server host name.

String
service_name

A string that represents the name of the service. This is the name people will see and use to identify the service. The name can only contain alphanumeric characters and underscores. No spaces or special characters are allowed. The name cannot be more than 120 characters in length.

String
folder_name

A string that represents a folder name.

String
connection_username

A string that represents a user name used to connect to ArcGIS for Server. This variable is only necessary when connecting to a UNIX/Linux ArcGIS for Server.

(默认值为 None)

String
connection_password

A string that represents a password used to connect to the ArcGIS for Server. This variable is only necessary when connecting to a UNIX/Linux ArcGIS for Server.

(默认值为 None)

String
connection_domain

A string that represents a domain name used to connect to the ArcGIS for Server. This variable is only necessary when connecting to a UNIX/Linux ArcGIS for Server.

(默认值为 None)

String
有关此主题的反馈?

ArcGIS for Desktop

  • 主页
  • 文档
  • 合约
  • 支持

ArcGIS 平台

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

关于 Esri

  • 关于我们
  • 招贤纳士
  • 内部人员博客
  • 用户大会
  • 开发者峰会
Esri
© Copyright 2016 Environmental Systems Research Institute, Inc. | 隐私政策 | 法律声明