使用 Azure 儲存體模擬器進行開發和測試Use the Azure Storage Emulator for development and testing

Microsoft Azure 儲存體模擬器是一種可模擬 Azure Blob、佇列和表格服務的工具,供本機開發之用。The Microsoft Azure Storage Emulator is a tool that emulates the Azure Blob, Queue, and Table services for local development purposes. 您可以針對儲存體服務在本機測試應用程式,而不需建立 Azure 訂用帳戶,也不會產生任何費用。You can test your application against the storage services locally without creating an Azure subscription or incurring any costs. 當您滿意應用程式在模擬器中的運作方式時,請切換到使用雲端中的 Azure 儲存體帳戶。When you're satisfied with how your application is working in the emulator, switch to using an Azure storage account in the cloud.

重要

不再積極開發 Azure 儲存體模擬器。The Azure Storage Emulator is no longer being actively developed. Azurite 是即將前進的儲存體模擬器平臺。Azurite is the Storage Emulator platform going forward. Azurite 會取代 Azure 儲存體模擬器。Azurite supersedes the Azure Storage Emulator. Azurite 將繼續更新以支援最新版本的 Azure 儲存體 Api。Azurite will continue to be updated to support the latest versions of Azure Storage APIs. 如需詳細資訊,請參閱 使用 Azurite 模擬器進行本機 Azure 儲存體開發For more information, see Use the Azurite emulator for local Azure Storage development.

取得儲存體模擬器Get the Storage Emulator

儲存體模擬器可作為 MICROSOFT AZURE SDK的一部分。The Storage Emulator is available as part of the Microsoft Azure SDK. 您也可以使用 獨立安裝程式 (直接下載) 來安裝儲存體模擬器。You can also install the Storage Emulator by using the standalone installer (direct download). 若要安裝儲存體模擬器,您必須具備電腦的系統管理許可權。To install the Storage Emulator, you must have administrative privileges on your computer.

儲存體模擬器目前只能在 Windows 上執行。The Storage Emulator currently runs only on Windows. 如果您需要適用于 Linux 的儲存體模擬器,有一個選項是已維護的「開放原始碼儲存體模擬器 Azurite」。If you need a Storage Emulator for Linux, one option is the community maintained, open-source Storage Emulator Azurite.

注意

使用不同的版本時,不保證可存取在某個儲存體模擬器版本中建立的資料。Data created in one version of the Storage Emulator is not guaranteed to be accessible when using a different version. 如果您需要長期保存資料,建議您將該資料儲存在 Azure 儲存體帳戶中,而不是儲存在儲存體模擬器中。If you need to persist your data for the long term, we recommended that you store that data in an Azure storage account, rather than in the Storage Emulator.

儲存體模擬器相依于特定版本的 OData 程式庫。The Storage Emulator depends on specific versions of the OData libraries. 不支援將儲存體模擬器所使用的 OData Dll 取代為其他版本,而且可能會造成非預期的行為。Replacing the OData DLLs used by the Storage Emulator with other versions is unsupported, and may cause unexpected behavior. 不過,儲存體服務支援的任何版本 OData 可能用來將要求傳送至模擬器。However, any version of OData supported by the storage service may be used to send requests to the emulator.

儲存體模擬器的運作方式How the storage emulator works

儲存體模擬器會使用本機的 Microsoft SQL Server 2012 Express LocalDB 實例來模擬 Azure 儲存體服務。The Storage Emulator uses a local Microsoft SQL Server 2012 Express LocalDB instance to emulate Azure storage services. 您可以選擇將儲存體模擬器設定為存取 SQL Server 的本機實例,而不是 LocalDB 實例。You can choose to configure the Storage Emulator to access a local instance of SQL Server instead of the LocalDB instance. 若要深入瞭解,請參閱本文稍後的 「啟動及初始化儲存體模擬器」 一節。See the Start and initialize the Storage Emulator section later in this article to learn more.

儲存體模擬器會使用 Windows 驗證連接到 SQL Server 或 LocalDB。The Storage Emulator connects to SQL Server or LocalDB using Windows authentication.

儲存體模擬器和 Azure 儲存體服務之間有一些功能上的差異。Some differences in functionality exist between the Storage Emulator and Azure storage services. 如需有關這些差異的詳細資訊,請參閱本文稍後的 儲存體模擬器與 Azure 儲存體 一節之間的差異。For more information about these differences, see the Differences between the Storage Emulator and Azure Storage section later in this article.

啟動及初始化儲存體模擬器Start and initialize the Storage Emulator

若要啟動 Azure 儲存體模擬器:To start the Azure Storage Emulator:

  1. 選取 [開始] 按鈕或按下 [Windows] 鍵。Select the Start button or press the Windows key.
  2. 開始輸入 Azure Storage EmulatorBegin typing Azure Storage Emulator.
  3. 從顯示的應用程式清單中選取模擬器。Select the emulator from the list of displayed applications.

當儲存體模擬器啟動時,會出現命令提示字元視窗。When the Storage Emulator starts, a Command Prompt window will appear. 您可以使用此主控台視窗來啟動和停止儲存體模擬器。You can use this console window to start and stop the Storage Emulator. 您也可以從命令提示字元清除資料、取得狀態,以及初始化模擬器。You can also clear data, get status, and initialize the emulator from the command prompt. 如需詳細資訊,請參閱本文稍後的 儲存體模擬器命令列工具參考 一節。For more information, see the Storage Emulator command-line tool reference section later in this article.

注意

如果另一個儲存體模擬器(例如 Azurite)正在系統上執行,則 Azure 儲存體模擬器可能無法正確啟動。The Azure Storage Emulator may not start correctly if another storage emulator, such as Azurite, is running on the system.

如果模擬器正在執行,您就會在 Windows 工作列通知區域看到圖示。When the emulator is running, you'll see an icon in the Windows taskbar notification area.

當您關閉儲存體模擬器的命令提示字元視窗時,儲存體模擬器會繼續執行。When you close the Storage Emulator Command Prompt window, the Storage Emulator will continue to run. 若要再次顯示儲存體模擬器主控台視窗,請遵循上述步驟,如同啟動儲存體模擬器一樣。To bring up the Storage Emulator console window again, follow the preceding steps as if starting the Storage Emulator.

當您第一次執行儲存體模擬器時,系統會為您初始化本機儲存體環境。The first time you run the Storage Emulator, the local storage environment is initialized for you. 初始化處理程序會在 LocalDB 中建立資料庫,並為每個本機儲存體服務保留 HTTP 連接埠。The initialization process creates a database in LocalDB and reserves HTTP ports for each local storage service.

儲存體模擬器預設會安裝至 C:\Program Files (x86)\Microsoft SDKs\Azure\Storage EmulatorThe Storage Emulator is installed by default to C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator.

提示

您可以使用 Microsoft Azure 儲存體總管 來處理本機儲存體模擬器資源。You can use the Microsoft Azure Storage Explorer to work with local Storage Emulator resources. 當您安裝並啟動儲存體模擬器之後,請在 & 資源樹狀結構中,尋找 [本機儲存體總管附加] 下的 [ (模擬器-預設埠) (金鑰) ]。Look for "(Emulator - Default Ports) (Key)" under "Local & Attached" in the Storage Explorer resources tree after you've installed and started the Storage Emulator.

初始化儲存體模擬器以使用不同的 SQL 資料庫Initialize the storage Emulator to use a different SQL database

您可以使用儲存體模擬器命令列工具來初始化儲存體模擬器,以指向預設 LocalDB 實例以外的 SQL 資料庫實例:You can use the storage Emulator command-line tool to initialize the Storage Emulator to point to a SQL database instance other than the default LocalDB instance:

  1. 開啟 [儲存體模擬器] 主控台視窗,如 啟動及初始化儲存體模擬器 一節中所述。Open the Storage Emulator console window as described in the Start and initialize the Storage Emulator section.

  2. 在主控台視窗中,輸入下列命令,其中 <SQLServerInstance> 是 SQL Server 執行個體的名稱。In the console window, type the following command, where <SQLServerInstance> is the name of the SQL Server instance. 若要使用 LocalDB,請指定 (localdb)\MSSQLLocalDb 做為 SQL Server 執行個體。To use LocalDB, specify (localdb)\MSSQLLocalDb as the SQL Server instance.

    AzureStorageEmulator.exe init /server <SQLServerInstance>

    您也可以使用下列命令,引導模擬器使用預設的 SQL Server 執行個體:You can also use the following command, which directs the emulator to use the default SQL Server instance:

    AzureStorageEmulator.exe init /server .

    或者,您可以使用下列命令,將資料庫初始化為預設 LocalDB 實例:Or, you can use the following command, which initializes the database to the default LocalDB instance:

    AzureStorageEmulator.exe init /forceCreate

如需這些命令的詳細資訊,請參閱 儲存體模擬器命令列工具參考For more information about these commands, see Storage Emulator command-line tool reference.

提示

您可以使用 Microsoft SQL Server Management Studio (SSMS) 來管理您的 SQL Server 執行個體,包括 LocalDB 安裝。You can use the Microsoft SQL Server Management Studio (SSMS) to manage your SQL Server instances, including the LocalDB installation. 在 SMSS [連接到伺服器] 對話方塊中,於 [伺服器名稱:] 欄位中指定 (localdb)\MSSQLLocalDb,以連接到 LocalDB 執行個體。In the SMSS Connect to Server dialog, specify (localdb)\MSSQLLocalDb in the Server name: field to connect to the LocalDB instance.

針對儲存體模擬器驗證要求Authenticating requests against the Storage Emulator

當您安裝並啟動儲存體模擬器之後,就可以對其測試您的程式碼。Once you've installed and started the Storage Emulator, you can test your code against it. 您對儲存體模擬器提出的每個要求都必須獲得授權,除非它是匿名要求。Every request you make against the Storage Emulator must be authorized, unless it's an anonymous request. 您可以使用共用金鑰驗證或共用存取簽章 (SAS) 來對儲存體模擬器授權要求。You can authorize requests against the Storage Emulator using Shared Key authentication or with a shared access signature (SAS).

使用共用金鑰認證進行授權Authorize with Shared Key credentials

模擬器支援單一固定帳戶及已知的驗證金鑰來進行共用金鑰驗證。The emulator supports a single fixed account and a well-known authentication key for Shared Key authentication. 此帳戶和金鑰是唯一允許與模擬器搭配使用的共用金鑰認證。This account and key are the only Shared Key credentials permitted for use with the emulator. 這些包括:They are:

Account name: devstoreaccount1
Account key: Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==

注意

模擬器所支援的驗證金鑰僅適用于測試用戶端驗證碼的功能。The authentication key supported by the emulator is intended only for testing the functionality of your client authentication code. 它不提供任何安全性用途。It does not serve any security purpose. 您無法將生產儲存體帳戶和金鑰與模擬器搭配使用。You cannot use your production storage account and key with the emulator. 您不應該將開發帳戶與生產資料搭配使用。You should not use the development account with production data.

模擬器僅支援透過 HTTP 連接。The emulator supports connection via HTTP only. 不過,HTTPS 是建議的通訊協定,用於存取生產 Azure 儲存體帳戶中的資源。However, HTTPS is the recommended protocol for accessing resources in a production Azure storage account.

使用快捷方式連接到模擬器帳戶Connect to the emulator account using the shortcut

從應用程式連接到模擬器最簡單的方式,就是在應用程式佈建檔中設定參考快捷方式的連接字串 UseDevelopmentStorage=trueThe easiest way to connect to the emulator from your application is to configure a connection string in your application's configuration file that references the shortcut UseDevelopmentStorage=true. 此快捷方式相當於模擬器的完整連接字串,它會指定每個 Azure 儲存體服務的帳戶名稱、帳戶金鑰和模擬器端點:The shortcut is equivalent to the full connection string for the emulator, which specifies the account name, the account key, and the emulator endpoints for each of the Azure Storage services:

DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;
AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;
BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;
QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;
TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;

下列 .NET 程式碼片段會示範如何從採用連接字串的方法使用快捷方式。The following .NET code snippet shows how you can use the shortcut from a method that takes a connection string. 例如, BlobContainerClient (字串,string) 的函式會採用連接字串。For example, the BlobContainerClient(String, String) constructor takes a connection string.

BlobContainerClient blobContainerClient = new BlobContainerClient("UseDevelopmentStorage=true", "sample-container");
blobContainerClient.CreateIfNotExists();

在呼叫程式碼片段中的程式碼之前,請先確定模擬器正在執行中。Make sure that the emulator is running before calling the code in the snippet.

如需連接字串的詳細資訊,請參閱設定 Azure 儲存體連接字串For more information on connection strings, see Configure Azure Storage connection strings.

使用共用存取簽章進行授權Authorize with a shared access signature

注意

本文已更新為使用 Azure Az PowerShell 模組。This article has been updated to use the Azure Az PowerShell module. Az PowerShell 模組是用來與 Azure 互動的建議 PowerShell 模組。The Az PowerShell module is the recommended PowerShell module for interacting with Azure. 若要開始使用 Az PowerShell 模組,請參閱安裝 Azure PowerShellTo get started with the Az PowerShell module, see Install Azure PowerShell. 若要瞭解如何遷移至 Az PowerShell 模組,請參閱將 Azure PowerShell 從 AzureRM 遷移至 Az。To learn how to migrate to the Az PowerShell module, see Migrate Azure PowerShell from AzureRM to Az.

某些 Azure 儲存體用戶端程式庫 (例如 Xamarin 程式庫),僅支援使用共用存取簽章 (SAS) 權杖進行的驗證。Some Azure storage client libraries, such as the Xamarin library, only support authentication with a shared access signature (SAS) token. 您可以使用 儲存體總管 或另一個支援共用金鑰驗證的應用程式來建立 SAS 權杖。You can create the SAS token using Storage Explorer or another application that supports Shared Key authentication.

您也可以使用 Azure PowerShell 來產生 SAS 權杖。You can also generate a SAS token by using Azure PowerShell. 下列範例會產生 SAS 權杖且對 blob 容器具有完整權限:The following example generates a SAS token with full permissions to a blob container:

  1. 安裝 Azure PowerShell (如果您尚未安裝,建議使用 Azure PowerShell Cmdlet 的最新版本)。Install Azure PowerShell if you haven't already (using the latest version of the Azure PowerShell cmdlets is recommended). 如需安裝指示,請參閱安裝和設定 Azure PowerShellFor installation instructions, see Install and configure Azure PowerShell.
  2. 開啟 Azure PowerShell 並執行下列命令,使用您所選的名稱來取代 CONTAINER_NAMEOpen Azure PowerShell and run the following commands, replacing CONTAINER_NAME with a name of your choosing:
$context = New-AzStorageContext -Local

New-AzStorageContainer CONTAINER_NAME -Permission Off -Context $context

$now = Get-Date

New-AzStorageContainerSASToken -Name CONTAINER_NAME -Permission rwdl -ExpiryTime $now.AddDays(1.0) -Context $context -FullUri

針對新容器產生的共用存取簽章 URI 應該類似下列項目:The resulting shared access signature URI for the new container should be similar to:

http://127.0.0.1:10000/devstoreaccount1/sascontainer?sv=2012-02-12&se=2015-07-08T00%3A12%3A08Z&sr=c&sp=wl&sig=t%2BbzU9%2B7ry4okULN9S0wst%2F8MCUhTjrHyV9rDNLSe8g%3Dsss

使用此範例建立的共用存取簽章的效期為一天。The shared access signature created with this example is valid for one day. 簽章會將完整存取權限 (讀取、寫入、刪除、列出) 授與容器內的 Blob。The signature grants full access (read, write, delete, list) to blobs within the container.

如需共用存取簽章的詳細資訊,請參閱 使用共用存取簽章將有限存取權授與 Azure 儲存體資源 (SAS) For more information on shared access signatures, see Grant limited access to Azure Storage resources using shared access signatures (SAS).

定址儲存體模擬器中的資源Addressing resources in the Storage Emulator

儲存體模擬器的服務端點與 Azure 儲存體帳戶的端點不同。The service endpoints for the Storage Emulator are different from the endpoints for an Azure storage account. 本機電腦不會進行功能變數名稱解析,要求儲存體模擬器端點必須是本機位址。The local computer doesn't do domain name resolution, requiring the Storage Emulator endpoints to be local addresses.

當您在 Azure 儲存體帳戶中定址資源時,可使用下列配置。When you address a resource in an Azure storage account, you use the following scheme. 帳戶名稱是 URI 主機名稱的一部分,而要定址的資源是 URI 路徑的一部分:The account name is part of the URI host name, and the resource being addressed is part of the URI path:

<http|https>://<account-name>.<service-name>.core.windows.net/<resource-path>

例如,下列 URI 是 Azure 儲存體帳戶中的有效 blob 位址:For example, the following URI is a valid address for a blob in an Azure storage account:

https://myaccount.blob.core.windows.net/mycontainer/myblob.txt

因為本機電腦不會進行功能變數名稱解析,所以帳戶名稱是 URI 路徑的一部分,而不是主機名稱。Because the local computer doesn't do domain name resolution, the account name is part of the URI path instead of the host name. 針對儲存體模擬器中的資源使用下列 URI 格式:Use the following URI format for a resource in the Storage Emulator:

http://<local-machine-address>:<port>/<account-name>/<resource-path>

例如,下列位址可能會用於存取儲存體模擬器中的 blob:For example, the following address might be used for accessing a blob in the Storage Emulator:

http://127.0.0.1:10000/myaccount/mycontainer/myblob.txt

儲存體模擬器的服務端點如下:The service endpoints for the Storage Emulator are:

  • Blob 服務:http://127.0.0.1:10000/<account-name>/<resource-path>Blob service: http://127.0.0.1:10000/<account-name>/<resource-path>
  • 佇列服務:http://127.0.0.1:10001/<account-name>/<resource-path>Queue service: http://127.0.0.1:10001/<account-name>/<resource-path>
  • 表格服務:http://127.0.0.1:10002/<account-name>/<resource-path>Table service: http://127.0.0.1:10002/<account-name>/<resource-path>

使用 RA-GRS 為帳戶次要位址定址Addressing the account secondary with RA-GRS

從3.1 版開始,儲存體模擬器支援 (GRS) 的讀取權限異地冗余複寫。Beginning with version 3.1, the Storage Emulator supports read-access geo-redundant replication (RA-GRS). 您可以將次要位置附加至帳戶名稱,以存取次要位置。You can access the secondary location by appending -secondary to the account name. 例如,下列位址可能用於在儲存體模擬器中使用唯讀次要資料庫存取 blob:For example, the following address might be used for accessing a blob using the read-only secondary in the Storage Emulator:

http://127.0.0.1:10000/myaccount-secondary/mycontainer/myblob.txt

注意

若要使用儲存體模擬器以程式設計方式存取次要資料庫,請使用適用于 .NET 3.2 版或更新版本的儲存體用戶端程式庫。For programmatic access to the secondary with the Storage Emulator, use the Storage Client Library for .NET version 3.2 or later. 如需詳細資訊,請參閱 Microsoft Azure Storage Client Library for .NET (適用於 .NET 的 Microsoft Azure 儲存體用戶端程式庫)。See the Microsoft Azure Storage Client Library for .NET for details.

儲存體模擬器命令列工具參考Storage Emulator command-line tool reference

從 3.0 版開始,當您啟動儲存體模擬器時,就會顯示主控台視窗。Starting in version 3.0, a console window is displayed when you start the Storage Emulator. 在主控台視窗中使用命令列來啟動和停止模擬器。Use the command line in the console window to start and stop the emulator. 您也可以查詢狀態,並從命令列進行其他作業。You can also query for status and do other operations from the command line.

注意

如果您已安裝 Microsoft Azure 計算模擬器,當您啟動儲存體模擬器時,就會出現系統匣圖示。If you have the Microsoft Azure Compute Emulator installed, a system tray icon appears when you launch the Storage Emulator. 使用滑鼠右鍵按一下圖示即可顯示功能表,提供圖形化方式來啟動和停止儲存體模擬器。Right-click on the icon to reveal a menu that provides a graphical way to start and stop the Storage Emulator.

命令列語法Command-line syntax

AzureStorageEmulator.exe [start] [stop] [status] [clear] [init] [help]

選項Options

若要檢視選項清單,請在命令提示字元輸入 /helpTo view the list of options, type /help at the command prompt.

選項Option 描述Description 命令Command 引數Arguments
開始Start 啟動儲存體模擬器。Starts up the Storage Emulator. AzureStorageEmulator.exe start [-inprocess] - 重新處理:在目前的進程中啟動模擬器,而不是建立新的進程。-Reprocess: Start the emulator in the current process instead of creating a new process.
停止Stop 停止儲存體模擬器。Stops the Storage Emulator. AzureStorageEmulator.exe stop
狀態Status 列印儲存體模擬器的狀態。Prints the status of the Storage Emulator. AzureStorageEmulator.exe status
清除Clear 清除命令列上指定的所有服務中的資料。Clears the data in all services specified on the command line. AzureStorageEmulator.exe clear [blob] [table] [queue] [all] blob:清除 blob 資料。blob: Clears blob data.
queue:清除佇列資料。queue: Clears queue data.
table:清除資料表資料。table: Clears table data.
all:清除所有服務中的所有資料。all: Clears all data in all services.
InitInit 進行一次性初始化以設定模擬器。Does one-time initialization to set up the emulator. AzureStorageEmulator.exe init [-server serverName] [-sqlinstance instanceName] [-forcecreate|-skipcreate] [-reserveports|-unreserveports] [-inprocess] -server serverName\instanceName︰指定裝載 SQL 執行個體的伺服器。-server serverName\instanceName: Specifies the server hosting the SQL instance.
-sqlinstance instanceName:指定在預設伺服器執行個體中使用之 SQL 執行個體的名稱。-sqlinstance instanceName: Specifies the name of the SQL instance to be used in the default server instance.
-forcecreate:強制建立 SQL 資料庫,即使它已經存在。-forcecreate: Forces creation of the SQL database, even if it already exists.
-skipcreate︰略過建立 SQL 資料庫。-skipcreate: Skips creation of the SQL database. 其優先順序高於 -forcecreate。This takes precedence over -forcecreate.
-reserveports︰嘗試保留與服務相關聯的 HTTP 連接埠。-reserveports: Attempts to reserve the HTTP ports associated with the services.
-unreserveports︰嘗試移除服務相關聯 HTTP 連接埠的保留。-unreserveports: Attempts to remove reservations for the HTTP ports associated with the services. 其優先順序高於 -reserveports。This takes precedence over -reserveports.
-inprocess:在目前的處理序中執行初始化,而不是繁衍新的處理序。-inprocess: Performs initialization in the current process instead of spawning a new process. 如果變更連接埠保留,必須以提高權限啟動目前的處理程序。The current process must be launched with elevated permissions if changing port reservations.

儲存體模擬器與 Azure 儲存體之間的差異Differences between the Storage Emulator and Azure Storage

因為儲存體模擬器是本機模擬環境,所以在雲端使用模擬器和 Azure 儲存體帳戶之間會有一些差異:Because the Storage Emulator is a local emulated environment, there are differences between using the emulator and an Azure storage account in the cloud:

  • 儲存體模擬器僅支援單一固定帳戶和知名的驗證金鑰。The Storage Emulator supports only a single fixed account and a well-known authentication key.
  • 儲存體模擬器不是可擴充的儲存體服務,也不支援大量的並行用戶端。The Storage Emulator isn't a scalable storage service and doesn't support a large number of concurrent clients.
  • 如在 儲存體模擬器中定址資源所述,儲存體模擬器和 Azure 儲存體帳戶的資源定址方式不同。As described in Addressing resources in the Storage Emulator, resources are addressed differently in the Storage Emulator versus an Azure storage account. 差別在於,網域名稱解析可在雲端中使用,但無法在本機電腦上使用。The difference is because domain name resolution is available in the cloud but not on the local computer.
  • 從3.1 版開始,儲存體模擬器帳戶支援「讀取權限地理區域冗余複寫」 (GRS) 。Beginning with version 3.1, the Storage Emulator account supports read-access geo-redundant replication (RA-GRS). 在模擬器中,所有帳戶都會啟用 GRS,而且主要和次要複本之間永遠不會有任何延遲。In the emulator, all accounts have RA-GRS enabled and there's never any lag between the primary and secondary replicas. 次要帳戶支援 Get Blob Service Stats、Get Queue Service Stats 和 Get Table Service Stats 作業,且這些作業一律會根據基礎 SQL 資料庫傳回 LastSyncTime 回應元素的值當成目前的時間。The Get Blob Service Stats, Get Queue Service Stats, and Get Table Service Stats operations are supported on the account secondary and will always return the value of the LastSyncTime response element as the current time according to the underlying SQL database.
  • 儲存體模擬器目前不支援檔案服務和 SMB 通訊協定服務端點。The File service and SMB protocol service endpoints aren't currently supported in the Storage Emulator.
  • 如果您使用模擬器不支援的儲存體服務版本,模擬器會傳回 VersionNotSupportedByEmulator 錯誤 (HTTP 狀態碼 400-錯誤的要求) 。If you use a version of the storage services that is not supported by the emulator, the emulator returns a VersionNotSupportedByEmulator error (HTTP status code 400 - Bad Request).

Blob 儲存體的差異Differences for Blob storage

下列差異適用於模擬器中的 Blob 儲存體:The following differences apply to Blob storage in the emulator:

  • 儲存體模擬器最多隻支援 2 GB 的 blob 大小。The Storage Emulator only supports blob sizes up to 2 GB.
  • 儲存體模擬器中 blob 名稱的最大長度是256個字元,而 Azure 儲存體中 blob 名稱的最大長度是1024個字元。The maximum length of a blob name in the Storage Emulator is 256 characters, while the maximum length of a blob name in Azure Storage is 1024 characters.
  • 增量複本會讓來自覆寫 blob 的快照進行複製,其會在服務時傳回失敗。Incremental copy allows snapshots from overwritten blobs to be copied, which returns a failure on the service.
  • 在使用增量複製 Blob 複製的快照之間,取得頁面範圍差異無法正常運作。Get Page Ranges Diff doesn't work between snapshots copied using Incremental Copy Blob.
  • 即使要求中未指定租用識別碼,對具有作用中租用的儲存體模擬器中的 blob 進行 Put Blob 作業可能會成功。A Put Blob operation may succeed against a blob that exists in the Storage Emulator with an active lease even if the lease ID hasn't been specified in the request.
  • 模擬器不支援附加 blob 作業。Append blob operations are not supported by the emulator. 在附加 Blob 上嘗試作業會傳回 FeatureNotSupportedByEmulator 錯誤 (HTTP 狀態碼 400-不正確的要求)。Attempting an operation on an append blob returns a FeatureNotSupportedByEmulator error (HTTP status code 400 - Bad Request).

資料表儲存體的差異Differences for Table storage

下列差異適用於模擬器中的資料表儲存體:The following differences apply to Table storage in the emulator:

  • 儲存體模擬器中的表格服務的日期屬性只支援 SQL Server 2005 所支援的範圍 (它們必須晚于 1753) 的1月1日。Date properties in the Table service in the Storage Emulator support only the range supported by SQL Server 2005 (they're required to be later than January 1, 1753). 1753 年 1 月 1 日之前的所有日期都會變成此值。All dates before January 1, 1753 are changed to this value. 日期的精確度受限於 SQL Server 2005 的精確度,也就是會精確度達到 1/300 秒。The precision of dates is limited to the precision of SQL Server 2005, meaning that dates are precise to 1/300th of a second.
  • 儲存體模擬器支援每個小於512位元組的資料分割索引鍵和資料列索引鍵屬性值。The Storage Emulator supports partition key and row key property values of less than 512 bytes each. 帳戶名稱、資料表名稱和索引鍵屬性名稱的總大小不能超過900個位元組。The total size of the account name, table name, and key property names together can't exceed 900 bytes.
  • 在儲存體模擬器中,資料表的資料列大小總計限制為小於 1 MB。The total size of a row in a table in the Storage Emulator is limited to less than 1 MB.
  • 在儲存體模擬器中,資料類型的屬性 Edm.GuidEdm.Binary 僅支援 Equal (eq) NotEqual (ne) 查詢篩選字串中的和比較運算子。In the Storage Emulator, properties of data type Edm.Guid or Edm.Binary support only the Equal (eq) and NotEqual (ne) comparison operators in query filter strings.

佇列儲存體的差異Differences for Queue storage

模擬器中的佇列儲存體沒有特定差異。There are no differences specific to Queue storage in the emulator.

儲存體模擬器版本資訊Storage Emulator release notes

版本5.10Version 5.10

  • 儲存體模擬器不會拒絕 Blob、佇列和表格服務端點上的2019-07-07 版儲存體服務。The Storage Emulator won't reject version 2019-07-07 of the storage services on Blob, Queue, and Table service endpoints.

版本5。9Version 5.9

  • 儲存體模擬器不會拒絕 Blob、佇列和表格服務端點上的2019-02-02 版儲存體服務。The Storage Emulator won't reject version 2019-02-02 of the storage services on Blob, Queue, and Table service endpoints.

版本5。8Version 5.8

  • 儲存體模擬器不會拒絕 Blob、佇列和表格服務端點上的2018-11-09 版儲存體服務。The Storage Emulator won't reject version 2018-11-09 of the storage services on Blob, Queue, and Table service endpoints.

5.7 版Version 5.7

  • 已修正啟用記錄時會造成當機的錯誤。Fixed a bug that would cause a crash if logging was enabled.

5.6 版Version 5.6

  • 儲存體模擬器現在支援 Blob、佇列和資料表服務端點上的2018-03-28 版儲存體服務。The Storage Emulator now supports version 2018-03-28 of the storage services on Blob, Queue, and Table service endpoints.

版本 5.5Version 5.5

  • 儲存體模擬器現在支援 Blob、佇列和資料表服務端點上的2017-11-09 版儲存體服務。The Storage Emulator now supports version 2017-11-09 of the storage services on Blob, Queue, and Table service endpoints.
  • 已新增 Blob Created 屬性的支援,它會傳回 Blob 建立時間。Support has been added for the blob Created property, which returns the blob's creation time.

版本 5.4Version 5.4

  • 若要改善安裝穩定性,模擬器不會嘗試在安裝時保留連接埠。To improve installation stability, the emulator no longer attempts to reserve ports at install time. 如果您想要保留埠,請使用 init 命令的 -reserveports 選項來指定它們。If you want port reservations, use the -reserveports option of the init command to specify them.

版本 5.3Version 5.3

  • 儲存體模擬器現在支援 Blob、佇列和資料表服務端點上的2017-07-29 版儲存體服務。The Storage Emulator now supports version 2017-07-29 of the storage services on Blob, Queue, and Table service endpoints.

5.2 版Version 5.2

  • 儲存體模擬器現在支援 Blob、佇列和資料表服務端點上的2017-04-17 版儲存體服務。The Storage Emulator now supports version 2017-04-17 of the storage services on Blob, Queue, and Table service endpoints.
  • 修正資料表屬性值未正確編碼的錯誤(bug)。Fixed a bug where table property values weren't being properly encoded.

版本 5.1Version 5.1

  • 修正了儲存體模擬器 DataServiceVersion 在服務不在某些回應中傳回標頭的錯誤(bug)。Fixed a bug where the Storage Emulator was returning the DataServiceVersion header in some responses where the service was not.

版本 5.0Version 5.0

  • 儲存體模擬器安裝程式不會再檢查現有的 MSSQL 和 .NET Framework 安裝。The Storage Emulator installer no longer checks for existing MSSQL and .NET Framework installs.
  • 儲存體模擬器安裝程式在安裝過程中不會再建立資料庫。The Storage Emulator installer no longer creates the database as part of install. 必要時仍會隨著啟動建立資料庫。Database will still be created if needed as part of startup.
  • 建立資料庫不再需要提高權限。Database creation no longer requires elevation.
  • 啟動不再需要保留連接埠。Port reservations are no longer needed for startup.
  • 將下列選項新增至 init-reserveports (需要提高權限)、-unreserveports (需要提高權限)、-skipcreateAdds the following options to init: -reserveports (requires elevation), -unreserveports (requires elevation), -skipcreate.
  • 系統匣圖示上的儲存體模擬器 UI 選項現在會啟動命令列介面。The Storage Emulator UI option on the system tray icon now launches the command-line interface. 已不再使用舊 GUI。The old GUI is no longer available.
  • 某些 DLL 已移除或重新命名。Some DLLs have been removed or renamed.

版本 4.6Version 4.6

  • 儲存體模擬器現在支援 Blob、佇列和資料表服務端點上的2016-05-31 版儲存體服務。The Storage Emulator now supports version 2016-05-31 of the storage services on Blob, Queue, and Table service endpoints.

版本 4.5Version 4.5

  • 修正當重新命名備份資料庫時,導致安裝和初始化失敗的 bug。Fixed a bug that caused installation and initialization to fail when the backing database is renamed.

4.4 版Version 4.4

  • 儲存體模擬器現在支援 Blob、佇列和資料表服務端點上的2015-12-11 版儲存體服務。The Storage Emulator now supports version 2015-12-11 of the storage services on Blob, Queue, and Table service endpoints.
  • 在處理大量 blob 時,儲存體模擬器的 blob 資料的垃圾收集現在更有效率。The Storage Emulator's garbage collection of blob data is now more efficient when dealing with large numbers of blobs.
  • 修正了造成容器 ACL XML 的驗證方式與儲存體服務的運作方式稍有不同的錯誤。Fixed a bug that caused container ACL XML to be validated slightly differently from how the storage service does it.
  • 修正了有時造成報告的日期時間上限和下限值時區不正確的錯誤。Fixed a bug that sometimes caused max and min DateTime values to be reported in the incorrect time zone.

版本 4.3Version 4.3

  • 儲存體模擬器現在支援 Blob、佇列和資料表服務端點上的2015-07-08 版儲存體服務。The Storage Emulator now supports version 2015-07-08 of the storage services on Blob, Queue, and Table service endpoints.

4.2 版Version 4.2

  • 儲存體模擬器現在支援 Blob、佇列和資料表服務端點上的2015-04-05 版儲存體服務。The Storage Emulator now supports version 2015-04-05 of the storage services on Blob, Queue, and Table service endpoints.

4.1 版Version 4.1

  • 儲存體模擬器現在支援 Blob、佇列和資料表服務端點上的2015-02-21 版儲存體服務。The Storage Emulator now supports version 2015-02-21 of the storage services on Blob, Queue, and Table service endpoints. 它不支援新的附加 blob 功能。It doesn't support the new append blob features.
  • 模擬器現在會針對不支援的儲存體服務版本傳回有意義的錯誤訊息。The emulator now returns a meaningful error message for unsupported versions of storage services. 我們建議使用最新版本的模擬器。We recommend using the latest version of the emulator. 如果您收到 VersionNotSupportedByEmulator 錯誤 (HTTP 狀態碼 400-錯誤的要求) ,請下載最新版本的模擬器。If you get a VersionNotSupportedByEmulator error (HTTP status code 400 - Bad Request), download the latest version of the emulator.
  • 修正競爭情形造成資料表實體資料在並行合併作業期間會不正確的 bug。Fixed a bug wherein a race condition caused table entity data to be incorrect during concurrent merge operations.

4.0 版Version 4.0

  • 儲存體模擬器可執行檔已重新命名為 AzureStorageEmulator.exeThe Storage Emulator executable has been renamed to AzureStorageEmulator.exe.

3.2 版Version 3.2

  • 儲存體模擬器現在支援 Blob、佇列和資料表服務端點上的2014-02-14 版儲存體服務。The Storage Emulator now supports version 2014-02-14 of the storage services on Blob, Queue, and Table service endpoints. 儲存體模擬器目前不支援檔案服務端點。File service endpoints aren't currently supported in the Storage Emulator. 如需有關 2014-02-14 版本的詳細資訊,請參閱 為 Microsoft Azure 中的 Blob、佇列和表格服務進行版本設定See Versioning for the Azure Storage Services for details about version 2014-02-14.

3.1 版Version 3.1

  • 儲存體模擬器現在支援讀取權限異地冗余儲存體 (RA-GRS) 。Read-access geo-redundant storage (RA-GRS) is now supported in the Storage Emulator. Get Blob Service StatsGet Queue Service StatsGet Table Service Stats api 支援次要帳戶,並且一律會根據基礎 SQL 資料庫,將 LastSyncTime response 元素的值傳回為目前時間。The Get Blob Service Stats, Get Queue Service Stats, and Get Table Service Stats APIs are supported for the account secondary and will always return the value of the LastSyncTime response element as the current time according to the underlying SQL database. 若要使用儲存體模擬器以程式設計方式存取次要資料庫,請使用適用于 .NET 3.2 版或更新版本的儲存體用戶端程式庫。For programmatic access to the secondary with the Storage Emulator, use the Storage Client Library for .NET version 3.2 or later. 如需詳細資訊,請參閱「Microsoft Azure Storage Client Library for .NET」。See the Microsoft Azure Storage Client Library for .NET Reference for details.

3.0 版Version 3.0

  • Azure 儲存體模擬器不再隨附于與計算模擬器相同的套件中。The Azure Storage Emulator is no longer shipped in the same package as the compute emulator.
  • 儲存體模擬器圖形化使用者介面已淘汰。The Storage Emulator graphical user interface is deprecated. 它已由可編寫腳本的命令列介面取代。It has been replaced by a scriptable command-line interface. 如需有關命令列介面的詳細資訊,請參閱儲存體模擬器命令列工具參考。For details on the command-line interface, see Storage Emulator Command-Line Tool Reference. 3.0 版仍將提供圖形化介面,除非在系統匣圖示按一下滑鼠右鍵並選取 [顯示儲存體模擬器 UI] 的方式安裝計算模擬器,否則無法存取圖形化介面。The graphical interface will continue to be present in version 3.0, but it can only be accessed when the Compute Emulator is installed by right-clicking on the system tray icon and selecting Show Storage Emulator UI.
  • 現在完全支援 2013-08-15 版的 Azure 儲存體服務。Version 2013-08-15 of the Azure storage services is now fully supported. (先前只有儲存體模擬器 2.2.1 版預覽才支援此版本)。(Previously this version was only supported by Storage Emulator version 2.2.1 Preview.)

下一步Next steps

另請參閱See Also