Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure CORS:No';访问控制允许原点';请求的资源上存在标头_Azure_.net Core_Cors_Angular5_Azure Storage Blobs - Fatal编程技术网

Azure CORS:No';访问控制允许原点';请求的资源上存在标头

Azure CORS:No';访问控制允许原点';请求的资源上存在标头,azure,.net-core,cors,angular5,azure-storage-blobs,Azure,.net Core,Cors,Angular5,Azure Storage Blobs,我有一个对Azure存储容器(BLOB)的POST调用,返回到以下错误。我也有CORS的配置。下面是方法。 我正在使用Angular 5和.net core 2.1 private static void ConfigureCors(ServiceProperties serviceProperties) { serviceProperties.Cors = new CorsProperties(); serviceProper

我有一个对Azure存储容器(BLOB)的POST调用,返回到以下错误。我也有CORS的配置。下面是方法。 我正在使用Angular 5和.net core 2.1

  private static void ConfigureCors(ServiceProperties serviceProperties)
        {
            serviceProperties.Cors = new CorsProperties();
            serviceProperties.Cors.CorsRules.Add(new CorsRule()
            {
                AllowedHeaders = new List<string>() { "*" },
                AllowedMethods = CorsHttpMethods.Put | CorsHttpMethods.Get | CorsHttpMethods.Head | CorsHttpMethods.Post,
                AllowedOrigins = new List<string>() { "*" },
                ExposedHeaders = new List<string>() { "*" },
                MaxAgeInSeconds = 200 
            });
        }
私有静态无效配置CORS(ServiceProperties ServiceProperties)
{
serviceProperties.Cors=新的CorsProperties();
serviceProperties.Cors.CorsRules.Add(新的CorsRule()
{
AllowedHeaders=new List(){“*”},
AllowedMethods=CorsHttpMethods.Put | CorsHttpMethods.Get | CorsHttpMethods.Head | CorsHttpMethods.Post,
AllowedOrigins=新列表(){“*”},
ExposedHeaders=new List(){“*”},
MaxAgeInSeconds=200
});
}

请在允许的方法中添加
PUT
,这是
PUT
操作,而不是
POST
操作

private static void ConfigureCors(ServiceProperties serviceProperties)
        {
            serviceProperties.Cors = new CorsProperties();
            serviceProperties.Cors.CorsRules.Add(new CorsRule()
            {
                AllowedHeaders = new List<string>() { "*" },
                AllowedMethods = CorsHttpMethods.Put | CorsHttpMethods.Get | CorsHttpMethods.Head | CorsHttpMethods.Post | CorsHttpMethods.Put,
                AllowedOrigins = new List<string>() { "*" },
                ExposedHeaders = new List<string>() { "*" },
                MaxAgeInSeconds = 200 
            });
        }
私有静态无效配置CORS(ServiceProperties ServiceProperties)
{
serviceProperties.Cors=新的CorsProperties();
serviceProperties.Cors.CorsRules.Add(新的CorsRule()
{
AllowedHeaders=new List(){“*”},
AllowedMethods=CorsHttpMethods.Put | CorsHttpMethods.Get | CorsHttpMethods.Head | CorsHttpMethods.Post | CorsHttpMethods.Put,
AllowedOrigins=新列表(){“*”},
ExposedHeaders=new List(){“*”},
MaxAgeInSeconds=200
});
}

我将调用更改为PUT,但它仍然抛出相同的错误。AzureCorseConfig.InitializeCors(storageAccount);CloudBlobClient blobClient=storageAccount.CreateCloudBlobClient();CloudBlobContainer container=blobClient.GetContainerReference(bucketName);bool iscontainerExis=wait container.CreateIfNotExistsAsync();CloudBlockBlob blockBlob=container.getblockblobbreference(asset.FileName);等待blockBlob.UploadFromStreamAsync(asset.OpenReadStream());var url=blockBlob.Uri;