你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Service Fabric 创建服务

创建或更新 Service Fabric 服务资源。

创建或更新具有指定名称的 Service Fabric 服务资源。

请求

方法 请求 URI
PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}?api-version=2017-07-01-preview

参数

名称 类型 必须 位置
subscriptionId 字符串 路径
resourceGroupName 字符串 路径
clusterName 字符串 路径
applicationName string 路径
serviceName 字符串 路径
api-version 字符串 查询
parameters ServiceResource “是” Body

subscriptionId

类型:字符串
必需:是

客户订阅标识符。


resourceGroupName

类型:字符串
必需:是

资源组的名称。


clusterName

类型:字符串
必需:是

群集资源的名称。


applicationName

类型:字符串
必需:是

应用程序资源的名称。


serviceName

类型:字符串
必需:是

服务资源的名称,格式为 {applicationName}~{serviceName}。


api-version

类型:字符串
必需:是
默认值:2017-07-01-preview

Service Fabric 资源提供程序 API 的版本。 这是必需参数,对于此规范,其值必须为“2017-07-01-preview”。


parameters

类型ServiceResource
必需:是

服务资源。

响应

HTTP 状态代码 说明 响应架构
202 (已接受) 请求已接受,操作将以异步方式完成。
ServiceResource
所有其他状态代码 详细的错误响应。
ErrorModel

示例

使用小数参数放置服务

请求

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resRg/providers/Microsoft.ServiceFabric/clusters/myCluster/applications/myApp/services/myService?api-version=2017-07-01-preview
正文
{
  "type": "services",
  "location": "eastus",
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resRg/providers/Microsoft.ServiceFabric/clusters/myCluster/applications/myApp/services/myService",
  "name": "myCluster",
  "tags": {},
  "properties": {
    "serviceKind": "Stateless",
    "serviceTypeName": "myServiceType",
    "partitionDescription": {
      "partitionScheme": "Singleton"
    },
    "instanceCount": "1"
  }
}

202 响应

标头
Retry-After: 10
Location: http://10.91.140.224/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceFabric/locations/eastus/operationResults/5bc615c3-6c5b-4593-80e1-008f55376ec7?api-version=2017-07-01-preview
正文
{
  "type": "services",
  "location": "eastus",
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resRg/providers/Microsoft.ServiceFabric/clusters/myCluster/applications/myApp/services/myService",
  "name": "myCluster",
  "tags": {},
  "etag": "W/\"636462502183671256\"",
  "properties": {
    "provisioningState": "Updating",
    "serviceKind": "Stateless",
    "serviceTypeName": "myServiceType",
    "partitionDescription": {
      "partitionScheme": "Singleton"
    },
    "instanceCount": "1"
  }
}

放置具有最大参数的服务

请求

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resRg/providers/Microsoft.ServiceFabric/clusters/myCluster/applications/myApp/services/myService?api-version=2017-07-01-preview
正文
{
  "type": "services",
  "location": "eastus",
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resRg/providers/Microsoft.ServiceFabric/clusters/myCluster/applications/myApp/services/myService",
  "name": "myCluster",
  "tags": {},
  "properties": {
    "serviceKind": "Stateless",
    "placementConstraints": "NodeType==frontend",
    "serviceTypeName": "myServiceType",
    "partitionDescription": {
      "partitionScheme": "Singleton"
    },
    "serviceLoadMetrics": [
      {
        "name": "metric1",
        "weight": "Low"
      }
    ],
    "correlationScheme": [
      {
        "serviceName": "fabric:/app1/app1~svc1",
        "scheme": "Affinity"
      }
    ],
    "servicePlacementPolicies": [],
    "defaultMoveCost": "Medium",
    "instanceCount": "5"
  }
}

202 响应

标头
Retry-After: 10
Location: http://10.91.140.224/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceFabric/locations/eastus/operationResults/2e633105-aadc-4928-9164-d76b974170a3?api-version=2017-07-01-preview
正文
{
  "type": "services",
  "location": "eastus",
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resRg/providers/Microsoft.ServiceFabric/clusters/myCluster/applications/myApp/services/myService",
  "name": "myCluster",
  "tags": {},
  "etag": "W/\"636462502183671258\"",
  "properties": {
    "provisioningState": "Updating",
    "serviceKind": "Stateless",
    "placementConstraints": "NodeType==frontend",
    "serviceTypeName": "myServiceType",
    "partitionDescription": {
      "partitionScheme": "Singleton"
    },
    "serviceLoadMetrics": [
      {
        "name": "metric1",
        "weight": "Low"
      }
    ],
    "servicePlacementPolicies": [],
    "defaultMoveCost": "Medium",
    "instanceCount": "5"
  }
}