Friday, May 10, 2013

Azure Deployment Things to remember

Better guidance with screen shots pls check it

1. Need to delete existing deployment package from the hosted application by using
2. Need to change local database  string to colud application database string in web.config or app.config
3.Need to install caching by using "Manage NuGet Packages for solution" by right click on solution 

Search for azure caching in "NuGet" Online search...  You will see "Windows Azure Caching"  then click on "Install" button

After cache installation  you will see the following content/commented content in web.config

    < section name ="dataCacheClients " type=" Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core" allowLocation= "true" allowDefinition=" Everywhere" />
    < section name ="cacheDiagnostics " type=" Microsoft.ApplicationServer.Caching.AzureCommon.DiagnosticsConfigurationSection, Microsoft.ApplicationServer.Caching.AzureCommon " allowLocation ="true " allowDefinition=" Everywhere" />

    < dataCacheClient name ="default ">
      < autoDiscover isEnabled ="true " identifier ="[cache cluster role name] " />
      <!-- <localCache isEnabled="true" sync="TimeoutBased" objectCount="100000" ttlValue="300" />-->
    </ dataCacheClient>
    < crashDump dumpLevel ="Off " dumpStorageQuotaInMB ="100 " />

 <!-- Windows Azure Caching session state provider -->
    <!-- <sessionState mode="Custom" customProvider="AFCacheSessionStateProvider">
        <add name="AFCacheSessionStateProvider" type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache" cacheName="default" dataCacheClientName="default" applicationName="AFCacheSessionState"/>
    </sessionState> -->
    <!-- Windows Azure Caching output caching provider -->
    <!-- <caching>
      <outputCache defaultProvider="AFCacheOutputCacheProvider">
          <add name="AFCacheOutputCacheProvider" type="Microsoft.Web.DistributedCache.DistributedCacheOutputCacheProvider, Microsoft.Web.DistributedCache" cacheName="default" dataCacheClientName="default" applicationName="AFCacheOutputCache" />
    </caching> -->
 Uncomment above 2 commented sections(Session State, Caching)
 Need to change  identifier  value("[cache cluster role name] ")  under  autoDiscover element to  your project current role name.
ex: My project Role Name: MyRole.  then the identifier value will be "My Role";
 < autoDiscover isEnabled = "true " identifier = "MyRole " />

- Now go to web role configuration.

- Enable caching for web role. Then double click on azure role and you will see "Caching" option then check "Enable caching" and specify the storage account credentials 

Check this link for caching info

-Set all the References "Copy Local" property to True

To Enable Win 32 Bit  to your cloud application. Perform the following steps
- Add Enable32BitAppPool file to your project and  set "Copy to Output Directory " to  "Copy Always"

Add the following task line in "ServiceDefinition.csdef" file under Startup section :

<Startup priority=" -2">
<Task commandLine="Enable32BitAppPool.cmd" executionContext="elevated" taskType="simple">

Import your colud profile to your application

- right click on  your azure project and click on publish you will see publish dialog
- If your already downloaded your cloud application settings click on import
- IF your not downloaded your cloud application settings click on "Sign in to download credentials" and download it and import it.
- Choose your subscription from the imported list.

- Click on next and ensure the cloud service and Check on "Enable Remote Desktop for all roles".

- Finally ensure all the configuration details and click on publish

Note: before starting publish. Close the other applications which consumes more virtual memory else you will get out of memory exception during the publish...

To enable SSL to your application