本文整理汇总了C#中CloudStorageAccount.SetServiceProperties方法的典型用法代码示例。如果您正苦于以下问题:C# CloudStorageAccount.SetServiceProperties方法的具体用法?C# CloudStorageAccount.SetServiceProperties怎么用?C# CloudStorageAccount.SetServiceProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CloudStorageAccount
的用法示例。
在下文中一共展示了CloudStorageAccount.SetServiceProperties方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}