Controller actions hit multiple times - ASP.NET MVC 4 App running in Azure Emulator

pentest

New Member
This might take some time to explain, but here I go :).I created two Visual Studio 2012 projects:[*]A project using the (Web -> ASP.NET MVC 4 Web Application) template in Visual Studio's Add Project dialog. I didn't add a unit test project.[*]A project using the Azure cloud service template (Cloud -> Windows Azure Cloud Service). I added a single role, an ASP.NET MVC 4 Web Role, and again didn't add a unit test project.I left both of these projects totally untouched from the way that Visual Studio created them for me.For each project, I then went to the \[code\]HomeController\[/code\] class and set a breakpoint in each of the \[code\]About\[/code\] and \[code\]Contact\[/code\] action methods (boring actions that just return a view). For example, I set a breakpoint on the only line in the method:\[code\]public ActionResult About(){ return View();}\[/code\]I then started debugging the first project (the non-Azure project). Everything was as expected - i.e. when I use the browser to navigate between the About and Contact pages, the breakpoint in the respective action methods would get hit once on each request. Seemed fine to me.I then started debugging the Azure project. I followed the same procedure of navigating between the About and Contact pages. This time I found interesting non-deterministic behaviour. On some requests, the breakpoint in the action method would be hit multiple times (sometimes more than twice) before the page would render. Sometimes the request would just hang and the page wouldn't render (even after minutes of waiting).I'd like to know why this is happening, because it is affecting more complicated things in another Azure MVC application that we're working on (e.g. due to this problem the application may attempt to create two or more instances of a model object in my database for the one request).I'm in the following environment:
  • Windows 8 Pro (x64)
  • Visual Studio 2012 Ultimate
  • Windows Azure SDK for Visual Studio 2012
  • IIS 8 Express
  • Firefox browser with Firebug (also confirmed the behavior using IE)
  • SQL Server 2012 (not really relevant I guess)
The only interesting thing that I noticed is that the following warning message comes up in the Output window in Visual Studio whenever I debug the Azure project:\[quote\] Remapping private port 80 to 81 in role 'My_Web_Role_Name' to avoid conflict during emulation.\[/quote\]Perhaps this remapping has something to do with it. Then again, after doing a \[code\]netstat -ano\[/code\] I saw that the Azure Development Fabric process is listening on port 80, so maybe that's why it needs to do the remapping...sounds fair enough.Anyway, I'm hoping that somebody might have an idea as to what could be causing this behavior. Here are some extra points and approaches I tried:
  • Reset IIS, restart Azure Compute/Storage emulator, restart entire machine
  • Strip the views of all script (i.e. the behavior is still there if the pages just have a basic HTML paragraph on them)
  • I tried to find the relevant IIS Express log files, but it seems that Azure projects don't run through IIS Express like the other project does (is that correct?).
  • I monitored the Azure Compute Emulator console...nothing very interesting there.
So...finally, some questions:
  • Can anybody else reproduce this behavior?
  • Are there any additional logs generated by the Azure Emulator that might help me out?
I'd really appreciate a push in the right direction here :).Cheers!
 
Back
Top