Start a new topic
Answered

Use Azure Emulator

Hello!!!


I know that it's possible to simulate Azure's architecture with an Emulator. All I have to do is to follow this article: http://msdn.microsoft.com/en-US/library/ff687127.aspx


When I do that in my own project it's really easy to use. But when I try it on VirtoCommerce project is's totally different... I have a problem with elasticsearch which throw an exception. How can I deal with this problem? Do I have improperly configure the webrole? Maybe I miss something like configure workerRoles?


Thank you in advance for your answers


Best Answer

Here are the steps to resolve issues running VC in emulator:


1. Download and install 2.2.1 version of emulator as described here: http://blogs.msdn.com/b/windowsazurestorage/archive/2014/01/27/windows-azure-storage-emulator-2-2-1-preview-release-with-support-for-2013-08-15-version.aspx (you need to manually copy files).

2. Change settings for the cloud project to use "emulator express" and "iisexpress" as described here: http://msdn.microsoft.com/library/azure/dn339018.aspx.


You should be able to run VC in emulator now. 


PS: the settings will be default in the upcoming 1.10 release



The azure emulator is not a complete environment and doesn't really behave like azure in a lot of cases. So I wouldn't use it much for development. That said, you can setup frontend and schedule to run in emulator quite easily. Simply run the packages as you do in the guide referenced. The Elastic Search will be a little different as it needs to have java runtime to be packaged with an installer and that is what setup script does, it copied Java to the folder and then packages everything together. We'll look into writing more guidance on how to do that in emulator. In the mean time, you can simply run elastic outside of the emulator while running everything else in it.

When you say outside of the emulator, do you mean with the elasticsearch.bat?

Yes, or you can setup SDK which will install elastic search as a windows service.

When I launch elasticsearch.bat there is no longer this error but I'm not able to access to the website... I have a http error 400: Bad Request - Invalid Hostname


Maybe I have to change some connection string in my webrole settings? I don't know...

Is it normal that the port used by visual studio is 81 or 82?


Not really normal. It can happen however if other ports are taken. Are you still launching using azure emulator? (as i mentioned earlier, emulator is really not that good, you better off running just a regular site). What address does your browser trying to open?

It tryes to open http://127.0.0.1:82/en-us/electronics


I know that azure emulator is not perfect but thanks to it I'm able to control if containers and blobs have been created correctly


EDIT: When I google this, most responses are dealing with IIS...

In the settings of the webrole, there is a line which is named IPAddressRules.Settings... Maybe the problem comes from here, does it?

Yes, remove that line. I also added:


<Setting name="DataConnectionString" value="UseDevelopmentStorage=true" />


specifying developer storage. It should have been there. Still investigating the issue with emulator.

When you say "remove", it means that I have to delete that line or just delete the value?

Remove the value, sorry for being vague. Was troubleshooting the issue. 


It seems like the 2.2 emulator doesn't support 3+ storage client version as described here: http://stackoverflow.com/questions/20284787/azure-400-bad-request-on-every-request. I'm going to try installing the latest emulator (2.3 and see if it works).

Answer

Here are the steps to resolve issues running VC in emulator:


1. Download and install 2.2.1 version of emulator as described here: http://blogs.msdn.com/b/windowsazurestorage/archive/2014/01/27/windows-azure-storage-emulator-2-2-1-preview-release-with-support-for-2013-08-15-version.aspx (you need to manually copy files).

2. Change settings for the cloud project to use "emulator express" and "iisexpress" as described here: http://msdn.microsoft.com/library/azure/dn339018.aspx.


You should be able to run VC in emulator now. 


PS: the settings will be default in the upcoming 1.10 release


I do all that stuff but I have the same problem that I had before with elasticsearch even the .bat is running...

I was able to replicate the "400: Bad Request - Invalid Hostname" issue and steps outlined fixed it. You need make sure to stop old emulator, copy files over and restart it. Also need to make sure the part 2 is done correctly.

And for elasticsearch, you have launch the .bat file as you said me before?


The good point is that there is no longer the "400: Bad Request - Invalid Hostname" issue^^ 

Login or Signup to post a comment