當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。