添加 VS 2015 SDK 后 Azure 存储模拟器失败
Posted
技术标签:
【中文标题】添加 VS 2015 SDK 后 Azure 存储模拟器失败【英文标题】:Azure Storage Emulator fails after adding VS 2015 SDK 【发布时间】:2015-05-28 03:26:18 【问题描述】:我已经安装了 Azure SDK 2.5 和 Tools for VS2013,并且运行良好已有一段时间了。今天我安装了 VS2015 的 SDK 和工具,现在我的 Azure 存储模拟器无法启动。在第一次尝试启动它时,我得到了一个 SqlException:
Unhandled Exception: System.Data.SqlClient.SqlException:
An error occurred while processing the log for database If possible,
restore from backup. If a backup is not available, it might be
necessary to rebuild the log.
重启机器后,我得到了一个较小的错误:
C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>WAStorageEmulator start Windows Azure Storage Emulator
3.4.0.0 command line tool Error: The storage emulator needs to be initialized. Please run the 'init' command.
但是运行 init 不起作用:
C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>WAStorageEmulator init Windows Azure Storage Emulator 3.4.0.0 command line tool Error: Cannot create database.
以 -inprocess 开头表示我的登录失败。我是这台机器的管理员,所以这很奇怪。
C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>WAStorageEmulator start -inprocess
Windows Azure Storage Emulator 3.4.0.0 command line tool
Cannot open database "WAStorageEmulatorDb34" requested by the login. The login failed.
Login failed for user 'DOMAIN\genslow'.
3/24/2015 10:00:57 AM [Info] Starting Service: Blob
3/24/2015 10:00:57 AM [Verbose_debug] [Nephos.Storage] Initialize
3/24/2015 10:00:57 AM [Info_debug] Loading config Param NephosAllowPathStyleUris (Allow path-style URIs) read: true
3/24/2015 10:00:57 AM [Info_debug] Successfully loaded NephosAllowPathStyleUris: True
3/24/2015 10:00:57 AM [Info_debug] Loading config Param NephosIncludeInternalDetailsInErrorResponses (Include internal details in error responses) read: false
3/24/2015 10:00:57 AM [Info_debug] Successfully loaded NephosIncludeInternalDetailsInErrorResponses: False
3/24/2015 10:00:57 AM [Info_debug] Loading config Param StampName (Stamp Name) read: StorageEmulator
3/24/2015 10:00:57 AM [Info_debug] BlockBlob: Load Interval failed. IsGC: True, Exception at System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt)
at Microsoft.WindowsAzure.DevelopmentStorage.Store.BlockBlobGarbageCollector.GetTimerIntervalOrDefault(Boolean isGC)
3/24/2015 10:00:57 AM [Info_debug] BlockBlob: Load Interval failed. IsGC: False, Exception at System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt)
at Microsoft.WindowsAzure.DevelopmentStorage.Store.BlockBlobGarbageCollector.GetTimerIntervalOrDefault(Boolean isGC)
3/24/2015 10:00:57 AM [Verbose_debug] [Nephos.Storage] Initialize
Service Status: Blob http://127.0.0.1:10000/ True
3/24/2015 10:00:57 AM [Info] Starting Service: Queue
3/24/2015 10:00:57 AM [Verbose_debug] [Nephos.Queue] Initialize
3/24/2015 10:00:57 AM [Info_debug] Loading config Param NephosAllowPathStyleUris (Allow path-style URIs) read: true
3/24/2015 10:00:57 AM [Info_debug] Successfully loaded NephosAllowPathStyleUris: True
3/24/2015 10:00:57 AM [Info_debug] Loading config Param NephosIncludeInternalDetailsInErrorResponses (Include internal details in error responses) read: false
3/24/2015 10:00:57 AM [Info_debug] Successfully loaded NephosIncludeInternalDetailsInErrorResponses: False
3/24/2015 10:00:57 AM [Info_debug] Loading config Param StampName (Stamp Name) read: StorageEmulator
3/24/2015 10:00:57 AM [Verbose_debug] [DevelopmentStorage.Queue] Initialize
Service Status: Queue http://127.0.0.1:10001/ True
3/24/2015 10:00:57 AM [Info] Starting Service: Table
3/24/2015 10:00:57 AM [Verbose_debug] [Nephos.Table] Initialize
3/24/2015 10:00:57 AM [Info_debug] Loading config Param NephosAllowPathStyleUris (Allow path-style URIs) read: true
3/24/2015 10:00:57 AM [Info_debug] Successfully loaded NephosAllowPathStyleUris: True
3/24/2015 10:00:57 AM [Info_debug] Loading config Param NephosIncludeInternalDetailsInErrorResponses (Include internal details in error responses) read: false
3/24/2015 10:00:57 AM [Info_debug] Successfully loaded NephosIncludeInternalDetailsInErrorResponses: False
3/24/2015 10:00:57 AM [Info_debug] Loading config Param StampName (Stamp Name) read: StorageEmulator
3/24/2015 10:00:57 AM [Info] NOT using custom threadpool for blocking calls
Service Status: Table http://127.0.0.1:10002/ True
使用 -inprocess 运行 init 会提供以下详细信息:
C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>WAStorageEmulator init -inprocess
Windows Azure Storage Emulator 3.4.0.0 command line tool
Added reservation for http://127.0.0.1:10000/ in user account DOMAIN\genslow.
Added reservation for http://127.0.0.1:10001/ in user account DOMAIN\genslow.
Added reservation for http://127.0.0.1:10002/ in user account DOMAIN\genslow.
Found SQL Instance (localdb)\MSSQLLocalDB.
Creating database WAStorageEmulatorDb34 on SQL instance '(localdb)\MSSQLLocalDB'.
Cannot create database 'WAStorageEmulatorDb34' : Database 'WAStorageEmulatorDb34' already exists. Choose a different database name..
One or more initialization actions have failed. Resolve these errors before attempting to run the storage emulator again.
Error: Cannot create database 'WAStorageEmulatorDb34' : Database 'WAStorageEmulatorDb34' already exists. Choose a different database name..
那么有什么办法可以从中恢复,还是我应该卸载所有东西并重新开始?
【问题讨论】:
【参考方案1】:您可以使用以下过程从涉及数据库的大多数初始化问题中恢复。请注意,当前模拟器中的所有数据都将丢失。
删除 SQL 实例:
sqllocaldb stop MSSQLLocalDB
sqllocaldb delete MSSQLLocalDB
现在删除以下数据库文件:
%USERPROFILE%\AzureStorageEmulatorDb*.mdf
%USERPROFILE%\AzureStorageEmulatorDb*.ldf
最后,重新创建sql实例:
sqllocaldb start MSSQLLocalDB
然后重试模拟器初始化。
【讨论】:
谢谢,我在使用 Azure SDK 2.8.2 和 Storage Emulator 4.2 时遇到了同样的问题,这解决了问题 我遇到了类似的问题,但我的 %USERPROFILE% 文件夹中没有 WAStorageEmulatorDb*.mdf 和 WAStorageEmulatorDb*.ldf 文件。 数据库名称现在是 AzureStorageEmulatorDb*。我已经相应地更新了答案。 也适用于 StorageEmulator 5.1.0.0! 对我来说(使用 VS2017 全新安装 W10,Emulator 5.7)这些步骤不起作用。我必须使用 SQLManagementStudio 在 (localdb)\MSSQLLocalDB 上手动创建空数据库 AzureStorageEmulatorDb57。然后 init 运行良好。【参考方案2】:我试图清理 localdb 但没有用,所以任何人在使用本地 db 运行存储模拟器时遇到问题都可以从这个命令中受益,以便在 SqlExpress 上运行它。
命令:AzureStorageEmulator.exe init -server . -sqlinstance SQLEXPRESS -forcecreate
【讨论】:
工作正常,确保您已经安装了 SQL Server Express!以上是关于添加 VS 2015 SDK 后 Azure 存储模拟器失败的主要内容,如果未能解决你的问题,请参考以下文章
Microsoft Azure Service Fabric SDK - 预览 1 fais 安装在 win 7 + VS 2015RC
无法将 Azure VM 上托管的 WCF 服务引用添加到 VS2015 项目
使用 Azure 存储 PHP SDK 时出现“其中一个请求输入超出范围”