windows azure常见问题处理及技巧[持续更新]
2010-09-15 15:21
471 查看
本贴记录windows azure 平台中遇到的常见问题以及解决方案和一些平常技巧。
因本人也是逐步在学习这个平台的东西,所以将持续更新,记录开发遇到的问题以及个人愚见的解决方案。有问题之处,欢迎指正。
本贴地址:/article/7068792.html
【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 (/article/7068790.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();
}
}
};
}); 【4】 关于部署
【4.1】 部署必要的dll到云端(第三方的,等等),通过IntelliTrace功能查询云端服务器已经具有的程序集。
【4.2】配置正确的Storage连接字符串。发布之时注意检查用于开发和产品环境的不同Storage连接字符串。
【4.3】注意32bit的程序集。云端是64位系统,可以加载运行32bit的程序集。
在可能的情况下,尽量使用64bit的程序集。另外一些32 Bit Native Library在云端可能会加载失败,可以通过IntelliTrace来跟踪。
【4.4】不要尝试运行需要管理员权限的组件。 (比如在云端写入注册表)
【4.5】配置正确的 ASP.NET providers。如果使用了Sql azure 作ASP.NET provider的存储,需要在Sql azure数据库中坐相应的初始化处理。或者使用azure table provider,或者其他…需要注意开发环境和产品环境的配置。
【4.6】尽量使用Https的Storage连接。
因本人也是逐步在学习这个平台的东西,所以将持续更新,记录开发遇到的问题以及个人愚见的解决方案。有问题之处,欢迎指正。
本贴地址:/article/7068792.html
【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 (/article/7068790.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();
}
}
};
}); 【4】 关于部署
【4.1】 部署必要的dll到云端(第三方的,等等),通过IntelliTrace功能查询云端服务器已经具有的程序集。
【4.2】配置正确的Storage连接字符串。发布之时注意检查用于开发和产品环境的不同Storage连接字符串。
【4.3】注意32bit的程序集。云端是64位系统,可以加载运行32bit的程序集。
在可能的情况下,尽量使用64bit的程序集。另外一些32 Bit Native Library在云端可能会加载失败,可以通过IntelliTrace来跟踪。
【4.4】不要尝试运行需要管理员权限的组件。 (比如在云端写入注册表)
【4.5】配置正确的 ASP.NET providers。如果使用了Sql azure 作ASP.NET provider的存储,需要在Sql azure数据库中坐相应的初始化处理。或者使用azure table provider,或者其他…需要注意开发环境和产品环境的配置。
【4.6】尽量使用Https的Storage连接。
相关文章推荐
- Recyclerview 常见问题处理(持续更新维护中...)
- [置顶] 编程时常见问题(持续更新)
- React Native常见问题汇总(持续更新ing)
- SQL语句常见问题的总结(持续更新)
- ubuntu常见问题(持续更新)
- Hadoop:Hadoop的常见启动错误(有新问题会持续更新)
- 日常遇到的常见问题记录 ------持续更新
- Moss/SharePoint 常见问题以及解决方法(持续更新中)
- [Java]常见算法问题(持续学习,更新)
- 使用的常见问题(持续更新)
- 工作项目中常见问题! 持续更新!
- [ExtNet]常见问题汇总--[持续更新]
- python中的常见问题(持续更新)
- SQL语句常见问题的总结(持续更新)
- iOS & Xcode 常见问题整理(持续更新……)
- Coolpy使用注意事项以及常见问题解决办法(持续更新中)
- [ios专项]Xcode 常见错误/警告,处理方法 (持续更新ing.._20140601)
- Ubuntu -- Ubuntu系统问题处理大全(持续 更新)
- JS常见问题整理(持续更新)
- lr常见问题汇总(持续更新版)