您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

使用 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.

获取存储模拟器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 的存储模拟器,一个选项是社区维护的开源存储模拟器AzuriteIf 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. 安装并启动存储模拟器后,在存储资源管理器资源树中的 "本地连接 &" 下查找 "(模拟器-默认端口)(Key)"。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 reinitializes 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 storage 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 storage emulator. 它们是:They are:

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

备注

存储模拟器支持的身份验证密钥仅用于测试客户端身份验证代码的功能。The authentication key supported by the storage 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 storage emulator. 不应将开发帐户用于生产数据。You should not use the development account with production data.

存储模拟器仅支持通过 HTTP 进行连接。The storage emulator supports connection via HTTP only. 但是,若要访问生产性 Azure 存储帐户中的资源,建议使用 HTTPS 协议。However, HTTPS is the recommended protocol for accessing resources in a production Azure storage account.

使用快捷方式连接到模拟器帐户Connect to the emulator account using a shortcut

从应用程序连接到存储模拟器的最简单方式是在应用程序的配置文件内配置一个引用快捷方式 UseDevelopmentStorage=true 的连接字符串。The easiest way to connect to the storage emulator from your application is to configure a connection string in your application's configuration file that references the shortcut UseDevelopmentStorage=true. 以下是 app.config 文件中指向存储模拟器的连接字符串示例:Here's an example of a connection string to the storage emulator in an app.config file:

<appSettings>
  <add key="StorageConnectionString" value="UseDevelopmentStorage=true" />
</appSettings>

使用从众所周知的帐户名称和密钥连接到存储模拟器Connect to the emulator account using the well-known account name and key

要创建引用存储模拟器帐户名称和密钥的连接字符串,必须在连接字符串中希望从模拟器中使用的每个服务指定终结点。To create a connection string that references the emulator account name and key, you must specify the endpoints for each of the services you wish to use from the emulator in the connection string. 这是必须的,这样连接字符串将引用与生产存储帐户中的终结点不同的模拟器终结点。This is necessary so that the connection string will reference the emulator endpoints, which are different than those for a production storage account. 例如,连接字符串的值将如下所示:For example, the value of your connection string will look like this:

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

此值等同于如上所示的快捷方式 UseDevelopmentStorage=trueThis value is identical to the shortcut shown above, UseDevelopmentStorage=true.

指定 HTTP 代理Specify an HTTP proxy

还可以指定一个 HTTP 代理,以便在针对存储模拟器测试服务时进行使用。You can also specify an HTTP proxy to use when you're testing your service against the storage emulator. 针对存储服务调试操作时,这对观察 HTTP 请求和响应很有用。This can be useful for observing HTTP requests and responses while you're debugging operations against the storage services. 要指定代理,请将 DevelopmentStorageProxyUri 选项添加到连接字符串,并将它的值设置为代理 URI。To specify a proxy, add the DevelopmentStorageProxyUri option to the connection string, and set its value to the proxy URI. 例如,下面是一个指向存储模拟器并配置 HTTP 代理的连接字符串:For example, here is a connection string that points to the storage emulator and configures an HTTP proxy:

UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://myProxyUri

有关连接字符串的详细信息,请参阅配置 Azure 存储连接字符串For more information on connection strings, see Configure Azure Storage connection strings.

使用共享访问签名进行授权Authorize with a shared access signature

备注

本文进行了更新,以便使用新的 Azure PowerShell Az 模块。This article has been updated to use the new Azure PowerShell Az module. 你仍然可以使用 AzureRM 模块,至少在 2020 年 12 月之前,它将继续接收 bug 修补程序。You can still use the AzureRM module, which will continue to receive bug fixes until at least December 2020. 若要详细了解新的 Az 模块和 AzureRM 兼容性,请参阅新 Azure Powershell Az 模块简介To learn more about the new Az module and AzureRM compatibility, see Introducing the new Azure PowerShell Az module. 有关 Az 模块安装说明,请参阅安装 Azure PowerShellFor Az module installation instructions, see Install Azure PowerShell.

某些 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. 以下示例会生成可完全访问 blob 容器的 SAS 令牌: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_NAME 替换为所选名称:Open 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.

有关共享访问签名的详细信息,请参阅使用共享访问签名(SAS)授予对 Azure 存储资源的有限访问权限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 版开始,支持读取访问地域冗余复制 (RA-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

备注

若要使用存储模拟器以编程方式访问次要副本,请使用 Storage Client Library for .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. 请参阅适用于 .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.
StopStop 停止存储模拟器。Stops the storage emulator. AzureStorageEmulator.exe stop
StatusStatus 打印存储模拟器的状态。Prints the status of the storage emulator. AzureStorageEmulator.exe status
ClearClear 清除命令行上指定的所有服务中的数据。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 版开始,支持读取访问地域冗余复制 (RA-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. 获取 Blob 服务统计信息、获取队列服务统计信息和获取表服务统计信息操作在帐户辅助上受支持,并且将始终根据基础 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.
  • 即使未在请求中指定租约 ID,Put Blob 操作也可能会对存储模拟器中存在且具有活动租约的 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 支持的范围(需要晚于年1月 1753 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.7Version 5.7

  • 修复了启用日志记录时可能导致崩溃的 bug。Fixed a bug that would cause a crash if logging was enabled.

版本 5.6Version 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.2Version 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

  • 修复了一个 Bug。出现该 Bug 时,存储模拟器会在某些不包含服务的响应中返回 DataServiceVersion 标头。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.4Version 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 的验证方式与存储服务的验证方式稍有不同的 bug。Fixed a bug that caused container ACL XML to be validated slightly differently from how the storage service does it.
  • 修复了有时会导致在不正确的时区报告最大和最小日期时间值的 bug。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.2Version 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.
  • 修复了在并发合并操作期间发生争用情况下导致表实体数据不正确的错误。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.2Version 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. 请参阅 Versioning for the Azure Storage Services(Azure 存储服务的版本控制)以了解有关 2014-02-14 版本的详细信息。See Versioning for the Azure Storage Services for details about version 2014-02-14.

版本 3.1Version 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 响应元素的值作为当前时间。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. 若要使用存储模拟器以编程方式访问次要副本,请使用 Storage Client Library for .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. 请参阅适用于 .NET 的 Microsoft Azure 存储客户端库参考获取详细信息。See the Microsoft Azure Storage Client Library for .NET Reference for details.

版本 3.0Version 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 版中,但仅在安装了计算模拟器的情况下通过右键单击系统托盘图标并选择“显示存储模拟器用户界面”来访问。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