如何在程序中启动Azure存储模拟器 [英] How to start Azure Storage Emulator from within a program
问题描述
我有使用Azure存储一些单元测试。当本地运行这些,我想他们使用Azure存储模拟器是在Azure SDK 1.5版的一部分。如果仿真器没有运行,我希望它被启动。
I have some unit tests that use Azure Storage. When running these locally, I want them to use the Azure Storage emulator which is part of the Azure SDK v1.5. If the emulator isn't running, I want it to be started.
要从命令行启动模拟器,我可以用这样的:
To start the emulator from the command line, I can use this:
"C:\Program Files\Windows Azure SDK\v1.5\bin\csrun" /devstore
这工作得很好。
当我尝试使用此C#code启动它,它崩溃:
When I try to start it using this C# code, it crashes:
using System.IO;
using System.Diagnostics;
...
ProcessStartInfo processToStart = new ProcessStartInfo()
{
FileName = Path.Combine(SDKDirectory, "csrun"),
Arguments = "/devstore"
};
Process.Start(processToStart);
我已经试过了许多的ProcessStartInfo设置摆弄,但似乎没有任何工作。是任何人有这个问题?
I've tried fiddling with a number of ProcessStartInfo settings, but nothing seems to work. Is anybody else having this problem?
我检查应用程序事件日志,发现以下两个项目:
I've checked the Application Event Log and found the following two entries:
事件ID:1023
.NET运行库版本2.0.50727.5446 - 致命的执行引擎错误(000007FEF46B40D2)(80131506)
Event ID: 1023 .NET Runtime version 2.0.50727.5446 - Fatal Execution Engine Error (000007FEF46B40D2) (80131506)
事件ID:1000
错误的应用程序名称:DSService.exe,版本:6.0.6002.18312,时间戳:0x4e5d8cf3
错误模块名称:的Mscorwks.dll,版本:2.0.50727.5446,时间戳:0x4d8cdb54
异常code:0000005
故障偏移:0x00000000001de8d4
出错进程ID:0X 9%
错误的应用程序启动时间:0x的10%
错误的应用程序路径:%11
错误模块路径:12%
报告编号:%13
Event ID: 1000 Faulting application name: DSService.exe, version: 6.0.6002.18312, time stamp: 0x4e5d8cf3 Faulting module name: mscorwks.dll, version: 2.0.50727.5446, time stamp: 0x4d8cdb54 Exception code: 0xc0000005 Fault offset: 0x00000000001de8d4 Faulting process id: 0x%9 Faulting application start time: 0x%10 Faulting application path: %11 Faulting module path: %12 Report Id: %13
推荐答案
我卸载所有的Windows Azure位:
I uninstalled all of the Windows Azure bits:
- WA SDK v1.5.20830.1814
- WA工具Visual Studio的:v1.5.40909.1602
- WA的AppFabric:v1.5.37
- WA的AppFabric:v2.0.224
然后,我下载并使用统一安装程序安装了一切。一切都来得除了AppFabric的V2回来。所有的版本号是相同的。重新运行我的测试中,仍然有问题。
Then, I downloaded and installed everything using the unified installer. Everything came back except the AppFabric v2. All the version numbers are the same. Reran my tests and still having a problem.
然后......(这是奇怪)...这将现在,然后每工作。重新启动机器,现在它的作品。有关机和重新启动,现在许多次......,它就可以工作。 (叹气)
And then...(this is weird)...it would work every now and then. Rebooted the machine and now it works. Have shutdown and rebooted a number of times now...and it just works. (sigh)
感谢大家谁提供了反馈和/或想法!
Thanks to everyone who provided feedback and/or ideas!
最后code是:
static void StartAzureStorageEmulator()
{
ProcessStartInfo processStartInfo = new ProcessStartInfo()
{
FileName = Path.Combine(SDKDirectory, "csrun.exe"),
Arguments = "/devstore",
};
using (Process process = Process.Start(processStartInfo))
{
process.WaitForExit();
}
}
这篇关于如何在程序中启动Azure存储模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!