11

Azure Storage (エミュレーター) テーブル サービスを使用するには、TypeScript ブラウザー アプリに CORS ルールを追加する必要があります。

REST インターフェイスを使用してそのルールを手動で追加したいと考えています (同じオリジン ポリシーを持つブラウザではなく、Postman から)。ドキュメントには、エミュレーターの正しい URL が記載されていません ( https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-table-service-properties )。DML コマンドの場合は、私の要求 ( https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/insert-entity ) のようになります。

リクエストは次のとおりです。

PUT /devstoreaccount1/?restype=service&comp=properties HTTP/1.1
Host: 127.0.0.1:10002
x-ms-version: 2013-08-15
Content-Type: application/xml
Cache-Control: no-cache
Postman-Token: 280f880b-d6df-bb1d-bc12-eca411e18310

<StorageServiceProperties>
    <Cors>
        <CorsRule>
            <AllowedOrigins>http://localhost:3030</AllowedOrigins>
            <AllowedMethods>GET,PUT,POST</AllowedMethods>
            <MaxAgeInSeconds>500</MaxAgeInSeconds>
            <ExposedHeaders>x-ms-meta-data*,x-ms-meta-target*,x-ms-meta-abc</ExposedHeaders>
            <AllowedHeaders>x-ms-meta-*</AllowedHeaders>
        </CorsRule>
    </Cors>
</StorageServiceProperties>

結果は次のとおりです。

<?xml version="1.0" encoding="utf-8"?>
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
    <m:code>ResourceNotFound</m:code>
    <m:message xml:lang="en-US">The specified resource does not exist.
RequestId:8137042f-0402-46c6-aa8c-fbf9f4601d33
Time:2017-01-15T09:13:51.7500394Z</m:message>
</m:error>

正しい URL は何ですか、または何が間違っていますか?

4

2 に答える 2