Ejemplo n.º 1
0
        /// 设置存储桶自定义域名
        public void PutBucketDomain()
        {
            //.cssg-snippet-body-start:[put-bucket-domain]
            try
            {
                string bucket = "examplebucket-1250000000"; //格式:BucketName-APPID

                DomainConfiguration domain = new DomainConfiguration();
                domain.rule        = new DomainConfiguration.DomainRule();
                domain.rule.Name   = "www.qq.com";
                domain.rule.Status = "ENABLED";
                domain.rule.Type   = "WEBSITE";

                PutBucketDomainRequest request = new PutBucketDomainRequest(bucket, domain);
                //执行请求
                PutBucketDomainResult result = cosXml.putBucketDomain(request);

                //请求成功
                Console.WriteLine(result.GetResultInfo());
            }
            catch (COSXML.CosException.CosClientException clientEx)
            {
                //请求失败
                Console.WriteLine("CosClientException: " + clientEx);
            }
            catch (COSXML.CosException.CosServerException serverEx)
            {
                //请求失败
                Console.WriteLine("CosServerException: " + serverEx.GetInfo());
            }
            //.cssg-snippet-body-end
        }