3
要使用Azure存儲(模擬器)表服務,我需要添加一個CORS規則爲我的打字稿瀏覽應用程序。如何添加一個CORS規則到Azure存儲模擬器與HTTP?
我想補充一點,規則手動使用REST接口(從郵差,不與同源策略的瀏覽器)。 文檔沒有給出仿真器(https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-table-service-properties)正確的URL。 對於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或我在做什麼錯?