从来源“ https:// ....实时站点的URL”访问“ https:// .............”处的XMLHttpRequest已被CORS政策禁止:否请求的资源上显示“ Access-Control-Allow-Origin”标头。
[EnableCors(origins: " http://localhost:50170, https://....url for live site/", headers: "*", methods: "put,delete")]
public HttpResponseMessage Get(string blobUri)
{
var credentials = new StorageCredentials("accountName",
"api key");
var blob = new CloudBlockBlob(new Uri(blobUri), credentials);
var sasParameters = new SharedAccessBlobPolicy()
{
SharedAccessExpiryTime = DateTime.UtcNow.AddMinutes(20),
Permissions = SharedAccessBlobPermissions.Write
};
var sasToken = blob.GetSharedAccessSignature(sasParameters);
var returnValue = blob.Uri.AbsoluteUri + sasToken;
return ReturnText(returnValue);
}
[HttpPost]
[EnableCors(origins: " http://localhost:50170, https://....url for live site/", headers: "*", methods: "post")]
public HttpResponseMessage Done()
{
HttpContent requestContent = Request.Content;
var stringContent = requestContent.ReadAsStringAsync().Result;
var query = HttpUtility.ParseQueryString(stringContent);
return ReturnText("{\"success\":true}");
}