当前位置: 首页>>代码示例>>C#>>正文


C# Protocol.ServiceProperties类代码示例

本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Shared.Protocol.ServiceProperties的典型用法代码示例。如果您正苦于以下问题:C# ServiceProperties类的具体用法?C# ServiceProperties怎么用?C# ServiceProperties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ServiceProperties类属于Microsoft.WindowsAzure.Storage.Shared.Protocol命名空间,在下文中一共展示了ServiceProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FileServiceProperties

 /// <summary>
 /// Initializes a new instance of the <see cref="FileServiceProperties"/> class.
 /// </summary>
 public FileServiceProperties()
 {
     this.serviceProperties = new ServiceProperties();
     this.serviceProperties.HourMetrics = null;
     this.serviceProperties.MinuteMetrics = null;
     this.serviceProperties.Logging = null;
 }
开发者ID:renlesterdg,项目名称:azure-storage-net,代码行数:10,代码来源:FileServiceProperties.cs

示例2: SetServiceProperties

 public Task SetServiceProperties(ServiceProperties properties, BlobRequestOptions requestOptions = null, OperationContext operationContext = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     return AsyncTaskUtil.RunAsyncCancellable(
         _inner.BeginSetServiceProperties(properties, requestOptions, operationContext, null, null),
         _inner.EndSetServiceProperties,
         cancellationToken);
 }
开发者ID:Porges,项目名称:azure-storage-async,代码行数:7,代码来源:AsyncCloudBlobClient.cs

示例3: StorageSettings

 public StorageSettings(string storageName, ServiceProperties serviceProperties)
 {
     InitializeComponent();
     this.Icon = Bitmaps.Azure_Explorer_ico;
     labelStorageAccount.Text = string.Format(labelStorageAccount.Text, storageName);
     _serviceProperties = serviceProperties;
 }
开发者ID:vaibhavkadian,项目名称:Azure-Media-Services-Explorer,代码行数:7,代码来源:StorageSettings.cs

示例4: InitializeCors

        private void InitializeCors()
        {
            var tableServiceProperties = new ServiceProperties();
            var tableClient =
                new CloudStorageAccount(
                    new StorageCredentials(
                        CloudConfigurationManager.GetSetting("storageAccountName"),
                        CloudConfigurationManager.GetSetting("storageAccountKey")),
                    true).CreateCloudTableClient();

            tableServiceProperties.HourMetrics = null;
            tableServiceProperties.MinuteMetrics = null;
            tableServiceProperties.Logging = null;

            tableServiceProperties.Cors = new CorsProperties();
            tableServiceProperties.Cors.CorsRules.Add(new CorsRule()
            {
                AllowedHeaders = new List<string>() { "*" },
                AllowedMethods =  CorsHttpMethods.Get | CorsHttpMethods.Head ,
                //AllowedOrigins = new List<string>() { "http://ercenkbike.azurewebsites.net/" },
                AllowedOrigins = new List<string>() { "*" },
                ExposedHeaders = new List<string>() { "*" },
                MaxAgeInSeconds = 1800 // 30 minutes
            });

            tableClient.SetServiceProperties(tableServiceProperties);
        }
开发者ID:morefun0302,项目名称:BikeTracker,代码行数:27,代码来源:Global.asax.cs

示例5: MyTestInitialize

        public void MyTestInitialize()
        {
            props = DefaultServiceProperties();

            if (TestBase.QueueBufferManager != null)
            {
                TestBase.QueueBufferManager.OutstandingBufferCount = 0;
            }
        }
开发者ID:benaadams,项目名称:azure-storage-net,代码行数:9,代码来源:QueueAnalyticsUnitTests.cs

示例6: MyClassInitialize

 public static void MyClassInitialize(TestContext testContext)
 {
     CloudQueueClient client = GenerateCloudQueueClient();
     startProperties = client.GetServiceProperties();
     if (TestBase.QueueBufferManager != null)
     {
         TestBase.QueueBufferManager.OutstandingBufferCount = 0;
     }
 }
开发者ID:huoxudong125,项目名称:azure-sdk-for-net,代码行数:9,代码来源:QueueAnalyticsUnitTests.cs

示例7: ExecuteCmdlet

        public override void ExecuteCmdlet()
        {
            ServiceProperties currentServiceProperties = Channel.GetStorageServiceProperties(ServiceType, GetRequestOptions(ServiceType), OperationContext);
            ServiceProperties serviceProperties = new ServiceProperties();
            serviceProperties.Clean();
            serviceProperties.Cors = currentServiceProperties.Cors;
            serviceProperties.Cors.CorsRules.Clear();

            Channel.SetStorageServiceProperties(ServiceType, serviceProperties,
                GetRequestOptions(ServiceType), OperationContext);
        }
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:11,代码来源:RemoveAzureStorageCORSRule.cs

示例8: ConfigureCors

 private void ConfigureCors(ServiceProperties serviceProperties)
 {
     serviceProperties.Cors = new CorsProperties();
     serviceProperties.Cors.CorsRules.Add(new CorsRule
     {
         AllowedHeaders = new[] { "*" },
         AllowedMethods = CorsHttpMethods.Get | CorsHttpMethods.Head,
         AllowedOrigins = new[] { "*" },
         ExposedHeaders = new[] { "Cache-Control", "Content-Type", "Last-Modified", "ETag", "Accept-Ranges" },
         MaxAgeInSeconds = 31536000
     });
 }
开发者ID:GusLab,项目名称:video-portal,代码行数:12,代码来源:BlobCorsInitializer.cs

示例9: ConfigureCors

 /// <summary>
 /// Adds CORS rule to the service properties.
 /// </summary>
 /// <param name="serviceProperties">ServiceProperties</param>
 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 = 1800 // 30 minutes
     });
 }
开发者ID:danieros,项目名称:AnimalReUnite,代码行数:16,代码来源:AzureCommon.cs

示例10: SetServicePropertiesAsync

        /// <summary>
        ///     Sets the properties of the table service asynchronously.
        /// </summary>
        /// <param name="tableClient">Cloud table client.</param>
        /// <param name="serviceProperties">The table service properties.</param>
        /// <param name="cancellationToken">Cancellation token.</param>
        /// <returns>Task.</returns>
        public static Task SetServicePropertiesAsync(
            this CloudTableClient tableClient,
            ServiceProperties serviceProperties,
            CancellationToken cancellationToken = default (CancellationToken))
        {
            ICancellableAsyncResult asyncResult = tableClient.BeginSetServiceProperties(serviceProperties, null, null);
            CancellationTokenRegistration registration = cancellationToken.Register(p => asyncResult.Cancel(), null);

            return Task.Factory.FromAsync(
                asyncResult,
                result =>
                    {
                        registration.Dispose();
                        tableClient.EndSetServiceProperties(result);
                    });
        }
开发者ID:dtretyakov,项目名称:WindowsAzure,代码行数:23,代码来源:CloudTableClientExtensions.cs

示例11: ExecuteCmdlet

        public override void ExecuteCmdlet()
        {
            ServiceProperties serviceProperties = new ServiceProperties();
            serviceProperties.Clean();
            serviceProperties.Cors = new CorsProperties();

            foreach (var corsRuleObject in this.CorsRules)
            {
                CorsRule corsRule = new CorsRule();
                corsRule.AllowedHeaders = corsRuleObject.AllowedHeaders;
                corsRule.AllowedOrigins = corsRuleObject.AllowedOrigins;
                corsRule.ExposedHeaders = corsRuleObject.ExposedHeaders;
                corsRule.MaxAgeInSeconds = corsRuleObject.MaxAgeInSeconds;
                this.SetAllowedMethods(corsRule, corsRuleObject.AllowedMethods);
                serviceProperties.Cors.CorsRules.Add(corsRule);
            }

            try
            {
                Channel.SetStorageServiceProperties(ServiceType, serviceProperties,
                    GetRequestOptions(ServiceType), OperationContext);
            }
            catch (StorageException se)
            {
                if ((null != se.RequestInformation) &&
                    ((int)HttpStatusCode.BadRequest == se.RequestInformation.HttpStatusCode) &&
                    (null != se.RequestInformation.ExtendedErrorInformation) &&
                    (string.Equals(InvalidXMLNodeValueError, se.RequestInformation.ExtendedErrorInformation.ErrorCode, StringComparison.OrdinalIgnoreCase) ||
                    string.Equals(InvalidXMLDocError, se.RequestInformation.ExtendedErrorInformation.ErrorCode, StringComparison.OrdinalIgnoreCase)))
                {
                    throw new InvalidOperationException(Resources.CORSRuleError);
                }
                else
                {
                    throw;
                }
            }

            if (PassThru)
            {
                WriteObject(this.CorsRules);
            }
        }
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:43,代码来源:SetAzureStorageCORSRule.cs

示例12: Main

        static void Main(string[] args)
        {
            StorageCredentials storageCredentials = new StorageCredentials(args[0], args[1]);
            CloudStorageAccount storageAccount = new CloudStorageAccount(storageCredentials, true);

            var blobClient = storageAccount.CreateCloudBlobClient();

            // Define our basics for quick op
            ServiceProperties blobServiceProperties = new ServiceProperties()
            {
                HourMetrics = null,
                MinuteMetrics = null,
                Logging = null,
            };

            // Define our CORS rules (wide open here)
            CorsRule corsRule = new CorsRule()
            {
                AllowedHeaders = new List<string>() { "*" },
                AllowedMethods = CorsHttpMethods.Get | CorsHttpMethods.Post | CorsHttpMethods.Head | CorsHttpMethods.Put,
                AllowedOrigins = new List<string>() { "*" },
                ExposedHeaders = new List<string>() { "*", "Accept-Ranges", "Content-Range"},

                MaxAgeInSeconds = 7200
            };

            // Set our rule
            blobServiceProperties.Cors.CorsRules.Add(corsRule);

            try
            {
                blobClient.SetServiceProperties(blobServiceProperties);
                Console.Out.WriteLine("CORS is rollin' for " + args[0]);
            }
            catch (Exception e)
            {
                Console.Out.WriteLine(e.ToString());
            }
        }
开发者ID:justinribeiro,项目名称:set-cors-azure,代码行数:39,代码来源:Program.cs

示例13: SetServicePropertiesAsync

 public IAsyncAction SetServicePropertiesAsync(ServiceProperties properties, BlobRequestOptions requestOptions, OperationContext operationContext)
 {
     BlobRequestOptions modifiedOptions = BlobRequestOptions.ApplyDefaults(requestOptions, BlobType.Unspecified, this);
     operationContext = operationContext ?? new OperationContext();
     return AsyncInfo.Run(async (token) => await Executor.ExecuteAsyncNullReturn(
          this.SetServicePropertiesImpl(properties, modifiedOptions),
         modifiedOptions.RetryPolicy,
         operationContext,
         token));
 }
开发者ID:renlesterdg,项目名称:azure-storage-net,代码行数:10,代码来源:CloudBlobClient.cs

示例14: SetStorageServiceProperties

 /// <summary>
 /// Set service properties
 /// </summary>
 /// <param name="account">Cloud storage account</param>
 /// <param name="type">Service type</param>
 /// <param name="properties">Service properties</param>
 /// <param name="options">Request options</param>
 /// <param name="operationContext">Operation context</param>
 public void SetStorageServiceProperties(StorageServiceType type, ServiceProperties properties, IRequestOptions options, OperationContext operationContext)
 {
     CloudStorageAccount account = StorageContext.StorageAccount;
     switch (type)
     {
         case StorageServiceType.Blob:
             account.CreateCloudBlobClient().SetServiceProperties(properties, (BlobRequestOptions)options, operationContext);
             break;
         case StorageServiceType.Queue:
             account.CreateCloudQueueClient().SetServiceProperties(properties, (QueueRequestOptions)options, operationContext);
             break;
         case StorageServiceType.Table:
             account.CreateCloudTableClient().SetServiceProperties(properties, (TableRequestOptions)options, operationContext);
             break;
         default:
             throw new ArgumentException(Resources.InvalidStorageServiceType, "type");
     }
 }
开发者ID:NordPool,项目名称:azure-sdk-tools,代码行数:26,代码来源:StorageBlobManagement.cs

示例15: DefaultServiceProperties

        private static ServiceProperties DefaultServiceProperties()
        {
            ServiceProperties props = new ServiceProperties();

            props.Logging.LoggingOperations = LoggingOperations.None;
            props.Logging.RetentionDays = null;
            props.Logging.Version = "1.0";

            props.HourMetrics.MetricsLevel = MetricsLevel.None;
            props.HourMetrics.RetentionDays = null;
            props.HourMetrics.Version = "1.0";

            props.MinuteMetrics.MetricsLevel = MetricsLevel.None;
            props.MinuteMetrics.RetentionDays = null;
            props.MinuteMetrics.Version = "1.0";

            props.Cors.CorsRules = new List<CorsRule>();

            return props;
        }
开发者ID:benaadams,项目名称:azure-storage-net,代码行数:20,代码来源:QueueAnalyticsUnitTests.cs


注:本文中的Microsoft.WindowsAzure.Storage.Shared.Protocol.ServiceProperties类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。