windowsazure常见问题处理及技巧

来源:微软认证    发布时间:2012-11-08    微软认证视频    评论

  【1】. Some Tips for table service.

  【1.1】 修改最大连接数,如果需要。

  Config file:

  <system.net>

  <connectionManagement>

  <add address = "*" maxconnection = "24" />

  </connectionManagement>

  </system.net>

  代码:

  ServicePointManager.DefaultConnectionLimit = 24;

  【1.2】 Turn off 100-continue

  Config file:

  <system.net>

  <settings>

  <servicePointManager expect100Continue="false" />

  </settings>

  </system.net>

  代码:

  ServicePointManager.Expect100Continue = false;

  【1.3】 关闭Context跟踪,如果用不上的环境(比如都是查询)

  context.MergeOption = MergeOption.NoTracking;

  【1.4】 合理利用PartitionKey & RowKey

  具体参见: More about “PartitionKey”&"RowKey” in windows azure table storage (http://www.cnblogs.com/ginohuo/archive/2010/08/31/1813753.html)

  <2> using customer httphandler in windows azure webrole, 在webrole中使用自定义HttpHandler.

  由于部署以后的webrole实际运行在IIS7上面,如果您配置的是:

  <system.web>

  <httpHandlers>

  将会报错,正确的配置是在<system.webServer>节点中。

  <system.webServer>

  <modules runAllManagedModulesForAllRequests="true"/>

  <validation validateIntegratedModeConfiguration="false"></validation>

  <handlers>

  <add path="*.do" name="KeywordsHandler" verb="GET" type="KeywordsWebRole.KeywordsHandler,KeywordsWebRole" resourceType="Unspecified" allowPathInfo="true"></add>

  </handlers>

  </system.webServer>

  <3> 使用role配置文件里的storage连接信息创建client account时,使用以下代码:

  CloudStorageAccount account = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");

  出现以下错误:

  Exception: SetConfigurationSettingPublisher needs to be called before FromConfigurationSetting can be used.

  解决方案:

  在 public override bool OnStart()中加入以下代码:

  CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>

  {

  configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));

  RoleEnvironment.Changed += (anotherSender, arg) =>

  {

  if (arg.Changes.OfType<RoleEnvironmentConfigurationSettingChange>()

  .Any((change) => (change.ConfigurationSettingName == configName)))

  {

  if (!configSetter(RoleEnvironment.GetConfigurationSettingValue(configName)))

  {

  RoleEnvironment.RequestRecycle();

  }

  }

  };

  });

视频学习

我考网版权与免责声明

① 凡本网注明稿件来源为"原创"的所有文字、图片和音视频稿件,版权均属本网所有。任何媒体、网站或个人转载、链接转贴或以其他方式复制发表时必须注明"稿件来源:我考网",违者本网将依法追究责任;

② 本网部分稿件来源于网络,任何单位或个人认为我考网发布的内容可能涉嫌侵犯其合法权益,应该及时向我考网书面反馈,并提供身份证明、权属证明及详细侵权情况证明,我考网在收到上述法律文件后,将会尽快移除被控侵权内容。

最近更新

社区交流

考试问答