Windows Azure for Visual Studio v1.4 でAzureアプリを作成して、そのままアップするとエラーになる

ダウンロード詳細 Windows Azure Tools for Microsoft Visual Studio 2010 1.4 (2011 年 8 月)
http://www.microsoft.com/downloads/ja-jp/details.aspx?FamilyID=f6d1609f-08aa-40d6-abd1-119503ecb1f9

をダウンロードして、日本語版の v1.4 を使うわけですが、そのままASP.NET Webアプリを作ってAzureにデプロイをするとエラーが発生します。

Windows Azure ASP.NET MVC 3 Web Role で使っているプロバイダ ≪ ブチザッキ
http://buchizo.wordpress.com/2011/08/04/windows-azure-asp-net-mvc-3-web-role-%e3%81%ab%e3%81%8a%e3%81%91%e3%82%8b%e3%83%87%e3%83%97%e3%83%ad%e3%82%a4%e6%99%82%e3%81%ae%e5%95%8f%e9%a1%8c/

Deploying the Windows Azure ASP.NET MVC 3 Web Role | Wade Wegner
http://www.wadewegner.com/2011/08/deploying-the-windows-azure-asp-net-mvc-3-web-role/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+WadeWegner+%28Wade+Wegner+-+Technical%29&utm_content=Google+Reader

これ、セッション情報を設定する sessionState のところが、Custom になっていて、このデータベース先が .\sqlexpress なのが原因なのですね。

<sessionState mode="Custom" customProvider="DefaultSessionProvider">
  <providers>
    <add name="DefaultSessionProvider"
         type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
         connectionStringName="DefaultConnection"
         applicationName="/" />
  </providers>
</sessionState>

確かに、複数のワーカープロセスでセッション情報を共有するので、SQL Serverを使う必要があるのは分かるんだけど、v1.3 には無かった記述が、いきなり v1.4 になって入っていて、しかも「何もせずにそのままデプロイしても落ちてる」っていうのは、駄目かなぁと。

なので、v1.4 で Azure アプリを作った時は、web.config を開いて、sessionState を削除します。
sessionState が無い時は、セッション情報はインプロセスになるので、Azure にデプロイしても正常に動作します。

で、

実運用的には、このセッション情報をどうするのか?が問題でして、案しては

1.SQL Azure に接続させる。
2.セッションサーバーを別途用意する。
3.Table Strage にセッション情報を用意する。

ってのが考えられます。

1の方法は、
Deploying the Windows Azure ASP.NET MVC 3 Web Role | Wade Wegner
http://www.wadewegner.com/2011/08/deploying-the-windows-azure-asp-net-mvc-3-web-role/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+WadeWegner+%28Wade+Wegner+-+Technical%29&utm_content=Google+Reader

に書いてある通り。SQL Azure に dbo.Sessions    テーブルを作成します。
ただし、SQL Azure を使うので課金が発生するんですよね。。。普通に Windows Azure アプリを作るだけなのに、SQL Azure への課金はちょっと痛い。

2.のほうは、ちと見当たらず。

問題は、セッションサーバー自身を Azure に置くわけですが、じゃあそのセッション情報は、SQL Azure を使うことになるのか?ということ。

で、3.の Table Strage にセッション情報を保存するのが現実的なのかなぁと。

Exercise 3: Using the Azure ASP.NET Providers with Web Form Applications
http://msdn.microsoft.com/en-us/wazplatformtrainingcourse_buildingaspnetappswithwindowsazure_topic4#_Toc300153323
に「Microsoft.Samples.ServiceHosting.AspProviders.TableStorageRoleProvider」の記述があるので、できるのかなと。

カテゴリー: 開発, Azure パーマリンク