如何排除Windows Azure Storage初始化失敗的問題

如何排除Windows Azure Storage初始化失敗的問題

當你利用Visual Studio建立Windows Azure Project後(以ASP.NET Web Role為例),建置專案後瀏覽網頁時可能遇到【Failed to initialize Windows Azure storage emulator.See output window for more infomation.】的錯誤訊息。

image

且Windows Azure Emulator也顯示【Storeage Emulator is shutdown】,在Visual Studio的輸出視窗有提示解決方案的訊息,訊息如下:

  • Windows Azure Tools: Warning: The Windows Azure development fabric and development storage are running on a 32-bit workstation. In the cloud, Windows Azure Hosted Services run in a 64-bit environment. The use of native code execution or .Net Full Trust features such as P/Invoke may require migration to 64-bit. See http://go.microsoft.com/fwlink/?LinkId=145047 for details.
  • Windows Azure Tools: Failed to initialize Windows Azure storage emulator. Unable to start Development Storage. Failed to start Development Storage: the SQL Server instance ‘localhost\SQLExpress’ could not be found.   Please configure the SQL Server instance for Development Storage using the ‘DSInit’ utility in the Windows Azure SDK.

可依照下列步驟來排除這個問題:

  1. 【Win + R】輸入【cmd】後按確定開啟命令列視窗。
  2. cd "C:\Program Files\Windows Azure SDK\v1.4\bin\devstore\"
  3. 輸入【DSInit /sqlInstance:<SQLServerInstance>】,若是本機的預設執行個體,可以輸入【DSInit /sqlInstance:.】。
  4. 接著就可以看到如下圖的訊息。

imageimage

建立成功後Windows Azure Emulator的【Start Storage Emulator】就被Enabled起來,點選之後把Storage Emulator啟動,就可以看到如下圖的模擬器。

image

此時再重新執行ASP.NET Web Role後即可看到ASP.NET部署到Windows Azure的模擬狀況(下圖左)以及網頁執行結果(下圖右)。

imageimage

 

 

【參考資料】