why two explorer windows are opened from visual studio in Azure project when I press F5 - azure

When I Press F5 to run the Azure project containing two worker roles and a web role. It opens two windows with same URL and they take so much time to open as well.
By time consuming, I mean, the website is taking too much time to load, but no such functionality or code is to be executed in the controller.
Can any body guide me on this?

It takes more time to start Azure project simply because it does more stuff. Just for starters, every time you press F5, it creates and configures new application pool for each role, then it creates and configures new web sites for each role instance.
I found it sometimes much faster to start the sites by pressing Ctrl+F5 (i.e. start without debugging). Then you can attach to your process manually, but you are free to do modifications to many files without re-deploying roles. This is especially helpful if you modify something that does not require rebuilding your binaries.
For your other question, you can control how browsers are launched for HTTP and HTTPS endpoints by using Configuration tab of the role properties. Just uncheck endpoints you don't want your browser to be launched on.

Try using the last Azure SDK edition v1.4. With the previous versions of the SDK there were some performance problems when running a service locally. Regarding the two opened windows problem, this might happen because the compute and the storage emulator were started manually on the local machine and not by the Visual Studio. At least in my case this was the problem. After shutting down the app., the compute and the storage emulator and running again the app.(F5) everything should be fine.

I've seen this happen before as well.
However, there is a way around it. You can edit the ServiceConfiguration.cscfg for your web role and set the instance count to 0. Then set your actual web application as the startup project instead of the Azure Web Role. This will allow you to use Cassini / IIS Express instead of the Compute Emulator to develop your web application.
NOTE: When you do a deployment you will have to set the instance count to something greater than one.
<ServiceConfiguration serviceName="Web" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="2" osVersion="*">
<Role name="WebRole1">
<Instances count="0" />
<ConfigurationSettings>
<Setting name="LogLevel" value="Error" />
</ConfigurationSettings>
</Role>
</ServiceConfiguration>
ALSO NOTE: There are certain features you will not be able to test when running your site like this. One example is local storage. If you're using features like that in your application you can simply switch the configuration and startup project back.
You'll also notice a huge speed increase when you press F5 to debug your application.

I've seen this happen with Chrome and Firefox. It doesn't happen with IE. Sorry I can't explain "why."

Related

How to speedup debugging on Azure Service Fabric?

Debugging an ASP.NET MVC application on the Azure Service Fabric platform takes a long time. How do I speed it up?
If you are talking about cloud cluster debugging then that is going to be a bit slow process if you are attaching debugger to that cluster, in which case you should be relying more on your application logs to find a problem because you should try to replicate the problem in your local cluster first and debugging that locally will be much easier.
Now if you are trying to debug on local cluster then couple of things are important to speed up things.
Set your cluster to run in 1 node configuration rather than 5 node
configuration.
Set your "Application Debug Mode" to "Refresh Application". To do
this, right click on the fabric project in your solution and click
on properties. you will see a window where you can set project
properties, here you will see this option of setting "Application
Debug Mode".
once you have done this then you can hit F5 and the debugging will be a lot faster. Also remember that you don't need to publish your application every time you make code changes, all you need is build and cluster will pick up changes and you can debug any time. one last thing to remember is that if you make any changes to your settings.xml or manifest.xml files you will need to publish in order for these settings to be picked up by the application.
Hope that helps.

How to deploy Azure service fabric project on to a remote cluster(Azure)

I have Created a cluster in Azure http://******.######.cloudapp.azure.com:19080
but don't know how to deploy my service fabric project on to it.
Link to application manifest
ApplicationManifest.xml
It's pretty well documented, unless you are getting specific errors, which you then will need to reference to get some worthwhile help
https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-publish-app-remote-cluster
Your first option is to use the powershell commands. You can also right-click your application in visual studio and select "Publish". Make sure you are using the correct publish profile.
Within Visual Studio, navigate to your Publish Profiles folder under the application and copy/paste the existing cloud.xml file and then rename appropriately. Ensure that you use the correct public facing I.P for your cluster, which will most likely be the load balancer.
The line should look like the following.
<ClusterConnectionParameters ConnectionEndpoint="<YOUR IP>:19000" />
Example:
<ClusterConnectionParameters ConnectionEndpoint="151.41.35.35:19000" />
However, if the cluster is secured you may need additional information. These options are shown within the commented Cluster Connection Parameters of the cloud.xml file.
Right click on the application, select publish and ensure the new publish profile is selected. Visual studio will attempt to validate the connection. Try to publish and keep an eye on the output window for insight in to the process.

Role instances are taking longer than expected to start - Is there a new solution to this problem?

I've rebooted my computer 50-100 times this week. I find I can start / deploy locally usually 3-4 times before getting this message:
"Windows Azure Tools for Microsoft Visual Studio
Role instances are taking longer than expected to start. Do you want to continue waiting?"
The solution to get me going again is rebooting.
I know it's not a new problem. I recall that MS agreed it was a problem but does anyone have a solution that does not involve going back to the Hosted Web Core. Seems like this problem is something a lot of people get and it's been around without a resolution (that I know of) for 4-5 months or more.
Now I'll get back to doing another reboot !!!!!
I had this same problem, but could eventually get it to start after dismissing 2 or 3 of the
"Role instances are taking longer than expected to start"
message boxes.
I then found that the problem seemed to be that the Diagnostics were enabled and the storage account was set to something invalid in the Role configuration (.cscfg).
Solved it by going into the UI and disabling diagnostics, I found it would run ok.
To get the UI, right click on the created Role inside the Roles folder in the Solution Explorer.
Then I re-enabled Diagnostics and it auto-populated "UseDevelopmentStorage=true", and this seems to work fine.
From what I understand, there are a few different things that can cause this issue.
For me, I encountered this error after I created a Windows Identity Foundation Startup Task for my Azure deployment and then tried to run my application using the Azure Emulator.
Basically, all I needed to do was change the taskType of the Startup Task from simple to background
ServiceDefinition.csdef
<Startup>
<Task commandLine="Startup\IdentityGac.cmd" executionContext="elevated" taskType="background"></Task>
</Startup>
Based on your question, I'm not sure if this applies to your project, but I figured it would at least be worth mentioning.
You can read my full blog post here.
A new cause for this problem was introduced in Feb 2016.
Using Windows 8.1, Visual Studio 2012 Update 5 and Azure Emulator 2.3
Installing this windows update: KB3126593 will leave you in a situation where the emulator will never start and you'll see this in the Emulator UI.
Uninstalling the update fixes the emulator.
Control Panel > All Control Panel Items > Programs and Features > Installed Updates
Security Update for Microsoft Windows (KB3126593), right-click, uninstall.
(Upgrading to Windows 10 also solves the problem.)
I was also facing the same issue. From looking into the Emulator UI I found that it was trying to read some date from storage area and was failing.
So what I did, I went to location %appdata%\local and deleted all data from folders
1. DevelopmentStorage
2. dftmp
After that restarting the service, every thing started working
For me, the problem was related to caching. The problem started with a warning that said something like, "unable to install cache....exe," but I only saw the error once. After that, the emulator stalled every time. After reading this blog I tried disabling and then re-enabling caching, which fixed the problem.
After I some further investigation I found that the critical issue was this entry in ServiceConfiguration.Local.cscfg:
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.ConfigStoreConnectionString" value="UseDevelopmentStorage=true" />
Previously this connection string had been pointing to a cloud storage connection.
In my experience this can happen if one of your roles does not stop when OnStop() is called. Look for WaWorkerHost.exe (I think). You might also try killing IisConfigurator.exe (or something like that). You know you've got the right process when your task manager list gets dramatically shorter :-)
I encountered the same issue and found the following steps resolved it (I stumbled across this solution when applying the answer from #RobPotter above).
First, opene the ServiceDefinition.csdef file and added this entry:
<Import moduleName="Diagnostics" />
To the: ServiceDefinition / WebRole / Imports node.
Second, add the following diagnostics configuration setting to the necessary .cscfg files:
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
under: ServiceConfiguration / Role / ConfigurationSettings for the web role.
FYI. My Service Definition value for schemaVersion is "2012-10.1.8". The issue may have arisen when I migrated my solution from SDK 1.7 to 1.8
I can't solve the problem after followed all the solutions above.
Finally, I decided not to let it stop my coding any more, just changed the StartUp Project from the 'Cloud Project' to the 'WebRole Project', and F5, ... OK website runs properly on my IIS Express.
So, I think, if it can publish to Azure, and can debug website local, so just let it work in this way, until Microsoft make it easier to use.
(my AzureSDK is 2.0)
Similar to answers above. I was running a startup script and it was running appcmd.exe, however, due to a mistake, the section I was trying to unlock caused an error, which made the roles fail to start.
I had used:
%windir%\System32\inetsrv\appcmd.exe unlock config /section:system.webServer/security
but this is an error and should have been
%windir%\System32\inetsrv\appcmd.exe unlock config /section:system.webServer/security/access
For me, this only happened when I had the checkbox for "Enable Caching" selected. And for me, the problem was that I was running my project off of a UNC Share (actually its running in a VM on my macbook). When I'd start the debugger after checking the "Enable Caching" box on the worker role, it would just hang. Come to find out, about every 2 seconds it was creating a 160MB dump file in C:\Windows\System32\%LOCALAPPDATA%\CrashDumps. After debugging one of those, I could see the first error was when it tried to start cmd.exe on the caching stuff in my worker role and it said CMD cannot be run on a network share, so it would default to windows/system32 or something.
That's when I found this handy dandy 7 year old MS KB article: http://support.microsoft.com/kb/156276 When I added DisableUNCCheck REG_DWORD and set the value to 0 x 1 (Hex) under the registry path HKEY_CURRENT_USER\Software\Microsoft\Command Processor everything started up just like a champ. Hopefully this helps someone else.
I have faced the same issue and spent lots of hours including checking all of the rest answers of this post. I just delete my application under the roles and again add webrole project in current solution. And working fine for me.
I had similar issue. I was executing an .cmd file to register a dependent DLL during the start of the debug session. The .CSDEF file looks like:
<ServiceDefinition name="WorkerRole.Azure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2014-06.2.4">
<WorkerRole name="SampleWorkerRole" vmsize="Small">
<Startup>
<Task commandLine="register.cmd" executionContext="elevated" taskType="simple" />
</Startup>
</WorkerRole>
</ServiceDefinition>
After starting the Visual Studio using "Run as Administrator" option, this issue did not occur. i was able to debug the application as usual.
My environment is:
Windows Service 2012 R2 + VS 2013 Update 3 + Azure Tools 2.2
Uninstall Windows update KB3126593 works for me!!!

How do I debug a Worker Role using Remote Desktop with Windows Azure?

I now have my Windows Azure environment set up so that I can access my Worker Role with Remote Desktop. However, I'm not sure how to proceed at the moment. After much digging I found a web site that was offline but in Google's cache there was mention of attaching to the Worker Role running in the Azure Cloud from the Visual Studio debugger. But I only have Visual Developer (not studio) 2010 and I have searched all over and as far as I can see there is no such option to attach to a remote server. I am able to publish my project to the Azure Cloud without error and I have a "healthy" instance of my Worker Role showing as active and running.
I did connect with RDP through the Azure Management portal. The login worked fine and up came the remote desktop window. I searched through much of what I could find and was unable to find my Worker Role. I must have the wrong impression of RDP, because I had hoped to see the Worker Role's main display form when I logged in, just like I do when I debug it locally in the Cloud Emulator. But instead all I saw was a blank desktop with some base level server inspection and management routines. I even checked the Event Viewer for Application related messages and saw none.
So now I'm stuck wondering if my Worker Role is actually running or not, despite the seemingly positive status messages from the Management Portal, and I still want to attach to my Worker Role for debugging through Visual Developer, if it's possible, but I am unable to figure out how.
Anyone with experience in this area that can give me some solid tips on what to do next, please respond.
UPDATE: I believe my worker role may be running because I opened a command window and did a Netstat and saw it listening on the correct port. However, that may just be my Worker Role shell class that starts the custom EXE I have it launch as a spawned proces. I still haven't confirmed if my custom EXE is running yet.
UPDATE-2: Just ran TaskList from a command window and the custom EXE is listed.
UPDATE-3: Everything is working as I just ran a remote test of the service so that's not a problem. Still want to know how to attach to the Worker Role from Visual Developer 2010 for remote debugging, and if it's possible to see the custom EXE's display form like I do when doing local debugging in the Cloud Emulator.
-- roschler
There is a set of articles here which goes in length on how to set up for remote debugging in Azure:
http://blogs.u2u.be/peter/post/2011/06/21/Remote-debugging-an-Azure-Worker-role-using-Azure-Connect-Remote-desktop-and-the-remote-debugger.aspx
http://blogs.u2u.be/peter/post/2011/06/24/Remote-debugging-an-Azure-worker-role-using-Azure-Connect-remote-desktop-and-remote-debugger-part-2.aspx
http://blogs.u2u.be/peter/post/2011/06/26/Remote-debugging-a-Windows-Azure-Worker-Role-using-Azure-Connect-Remote-desktop-and-the-remote-debugger-part-3.aspx
The key takeaway is that you don't need to actually install Visual Studio on Azure, you only need to copy the Remote Debugger bits and then use Azure Connect to add your developer machine to the Virtual Network.
You can setup Remote Debugging with Visual Studio 2012
http://code.msdn.microsoft.com/Remote-Debugging-Windows-dedaaec9
When you say:
But instead all I saw was a blank desktop with some base level server inspection and management routines.
this is exactly what you get with an Azure VM. It's a basic OS install, plus the bare minimum of Azure stuff it needs to run and the code you've uploaded. There's no fancy monitoring or health checks available on the machine by default, you're expected to have provided those yourself to have them available without having to RDP into the machine to check on it.
RDP is very good for tracking down certain problems, like checking that a startup task will run, checking which directories items are installed in and just generally being nosey. If you need extra tools to track down a problem, you can just install them while you're connected to the server. For example I have RDPed into a server and installed the Microsoft Debugging Tools, to track down a memory issue.
I suppose you could remote into your VM, install Visual Studio there, and debug the process...
I also suppose it might be possible to enable remote debugging (not sure what's involved there, but such a thing exists, and it works over TCP) and debug from a local instance of Visual Studio.
To my knowledge, neither is commonly done.
Based on other answers, you would be better off writing a log file to a local storage. You can read the file from RDP if you reallyhace to. Keep in mind, debugging on Azure isn't really simple, and rightly so.
What I was thinking though was, maybe you could run the process using the user's credentials. I can't verify at the moment, but you have a better shot of seeing the ui when you rdp.

Windows Azure local development environment speed

I've started porting an existing ASP.NET web app to Windows Azure and have noticed that the development process is really slow. Each time I make a change to my code and want to view it, I have to effectively redeploy it to the local dev cloud (using Start debugging (F5) or Start without debugging (Ctrl-F5). The process itself takes over a minute, during which time Visual Studio is completely unresponsive.
Am I doing something wrong or is that simply how things are developing for Azure?
My specs:
Visual Studio 2008 9.0.30729.1 SP
5 projects running on .NET 3.5 SP1
Azure SDK 1.1 (February 2010)
Single instance of a single web role
Dual-core AMD 64 machine with 8GB RAM, 64-bit Windows 7, fully patched
The main project itself is quite large (3k files, ~200k lines) but compiles normally in 10-15 seconds
If your web role has limited functionality, you might be able to just set the Web project as the Active Project in your VS solution and run from there.
For example, my web role doesn't call into table storage, blob storage, etc... it just makes some Azure logging calls and interacts with SQL Azure. So sometimes I just set the web project to be the startup project in the VS debugger, not Azure, and run from there. I've properly written my logging calls to check if Azure is available before they write, so they don't execute in this situation.
Of course, if you're doing lots with table storage, queues, blobs, etc. then this is not for you.
Normally in a development machine we just compile and run the solution. In case of Azure development there is a additional step where the specific project is deployed in the Dev fabric which involves copying the complete web site content to the dynamically created deployment folder. Since you have a large number of files this would require all those files to be copied into a new folder every time you press F5 or Ctrl-F5. This may cause the delay you are noticing.
This scenario also highlights the inflexibility in deploying the solution over the App fabric. Any time you change any content (static or dynamic) in the website the complete site has to be packaged and re uploaded on your production server.
In my case when I changed the port from 80 to something else (under end points) the speed returned to normal.
Microsoft's Steve Marx has a blog post about running a website from a mounted VM in Azure. This may be a good development pattern since you simply update the contents of a VM stored in blob storage instead of having to redeploy to the fabric each time.

Resources