I have an ASP.NET MVC project that uses Azure Storage and has been successfully deployed to Azure. However when run the project locally, it does not start the Azure emulator.
The only way I have found of starting the Azure emulator is to make a 'Windows Azure Cloud Service' shortcut and run that manually.
Is there a way to make ensure the Azure emulator runs when I start my app?
I have a cloud service in the same project as my MVC site. Since you've already created the MVC project give this a try...
I Just verified this in VS2012, it had been a couple of months since I had done it.
Without a cloud services project inside your solution, it might be tricky. There're a few things you could do:
Start storage emulator in your code when you start debugging your application. What you could do is start the storage emulator process in your Application_Start() method using code something like this [It's obviously a hack, and not sure an elegant one :)]:
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); #if (DEBUG) { Process.Start(@"C:\\Program Files\\Microsoft SDKs\\Windows Azure\\Emulator\\devstore\\DSServiceLDB.exe"); } #endif }
My guess is that with this you would need to run VS as Administrator. I tried the above code, and it worked fine. The code above assumes that your storage emulator uses LocalDB for storage.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.