This post records common issues, solutions, and common skills encountered on the Windows azure platform.
As I am gradually learning about this platform, I will continue to update and record the problems encountered in development and my humble opinion solutions. If you have any questions, please correct them.
Address: http://www.cnblogs.com/ginohuo/archive/2010/09/15/1827062.html
[1]. Some tips for table service.
[1.1] modify the maximum number of connections if needed.
Config file:
<System.net>
<Connectionmanagement>
<Add address = "*" maxconnection = "24"/>
</Connectionmanagement>
</System.net>
Code:
Servicepointmanager. defaultconnectionlimit = 24;
[1.2] Turn off 100-continue
Config file:
<System.net>
<Settings>
<Servicepointmanager expect100continue = "false"/>
</Settings>
</System.net>
Code:
Servicepointmanager. expect100continue = false;
[1.3] disable context tracing. If the context cannot be used (for example, it is a query)
Context. mergeoption = mergeoption. notracking;
[1.4] reasonable use of partitionkey & rowkey
See 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, use custom httphandler in webrole.
Because the deployed webrole actually runs on iis7, If you configure:
<System. Web>
<Httphandlers>
An error is reported. The correct configuration is in the <system. webserver> node.
<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>Use the following code to create a client account using the storage connection information in the role configuration file:
Cloudstorageaccount account = cloudstorageaccount. fromconfigurationsetting ("dataconnectionstring ");
The following error occurs:
Exception: setconfigurationsettingpublisher needs to be called before fromconfigurationsetting can be used.
Solution:
Add the following code to 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] about deployment
[4.1] deploy necessary DLL files to the cloud (third-party files, and so on), and query the existingProgramSet.
[4.2] configure the Correct storage connection string. Check the different storage connection strings used for development and product environments during release.
[4.3] Pay Attention to the 32bit assembly. The cloud is a 64-bit system that can load 32-bit assembly.
Whenever possible, use 64-bit assembly. In addition, some 32-bit native libraries may fail to be loaded on the cloud, which can be tracked through intelliitrace.
[4.4] Do not try to run components that require administrator permissions. (For example, writing a registry to the cloud)
[4.5] configure the correct ASP. NET providers. If SQL Azure is used for ASP. NET provider storage, You need to initialize the database in SQL azure. Or use azure table provider, or other... Pay attention to the configuration of the development environment and product environment.
[4.6] Try To Use https storage connection.