Question

I am building a Azure cloud project which has a web role. The web role contains Web APIs and my colleagues have been testing those APIs through a remote machine. So when i run the project on VS, the emulator starts and the web role is hosted on IIS. But as soon as i stop the project on VS, the emulator also removes the web role from IIS. Its obvious why that happens but is there any way that i can keep the web role running on emulator continuously and simultaneously work on the code in my VS. Because it gets really difficult for me that whenever my colleagues want to test the APIs i have to stop working on VS.

Is there any work around or solution for this?

Thanks

EDIT:

ServiceConfiguration.Local.cscfg

<ConfigurationSettings>     
  <Setting name="StorageConnectionString" value="UseDevelopmentStorage=true" />
<ConfigurationSettings>

Web Role:

var cloudStorageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
Was it helpful?

Solution

There are several approaches you might take:

  1. You could have the team members test the APIs on a a test deployment, not on your development machine. For instance you can use an extra small web role instance running on Azure. In Visual Studio you can use the Web Deploy feature to quickly update this instance with new code. It can take as little as a couple seconds to have your changes live. This approach has the added benefit that your coworkers' tests won't be impacted by breaking changes you do while developing (for instance having your project in a state that is not compiling or working properly).

  2. You could run two Visual Studio instances on your machine: one running the web role in debug mode on the Azure emulator, and another in development mode.

  3. You could configure your project in Visual Studio to integrate with IIS so it can be executed through your machine's IIS server (outside the Azure emulator). Your code can still access the emulated table service as long as the Azure storage emulator is running. In fact, even a WinForms or console project can use the services of the storage emulator. The client code itself doesn't need to be running under the Azure compute emulator (that's two different, separate emulators). In this case you won't get the storage connection string from the web role configuration, but from an application configuration such as Web.config or App.config.

I would recommend approach 1, i.e., to have a separate test environment. You could even run automated integration tests against it. You would have the added advantage of running on Azure itself, not on the emulator. There are a few behavior differences and this way you would detect them earlier in your lifecycle.

If your team wants to reach the next level, you could set up continuous delivery so that when there is any repository commit on any of your projects, there is a build, a deployment to Azure and a set of automated tests.

OTHER TIPS

Consider setting up continuous delivery: Continuous delivery to Windows Azure by using Team Foundation Service

Advantages:

  • After each check-in (or every day...) your application will be deployed automatically to your Cloud Service. That way your other developers can use this version to work with the API.
  • You can keep developing locally without hassle
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top