I'm building an application which will be run on Azure. My Visual Studio solution contains multiple Azure role projects. When debugging locally, I use the Azure compute emulator.
To start debugging, I follow these steps:
I right-click on my Azure project and click Set as start up project.
I press F5 to start the debugger.
What happens now is that the emulator/vs2010 launches both my web roles and worker roles, even if I'm only interested in debugging a single worker role at the moment. Often when writing some background-processing code in my worker role, I'm interested to step through that code without starting the web role, launch Internet Explorer and so on as well.
Is there a convinient way to make the debugger only launch one of the role instances and not all of them?
I'm thinking of creating a separate project in my solution of type Console Application, where I load the same assemblies as in my worker role and execute the same code.
The emulator (similar to Azure itself) works just on the concept of a "Cloud Service". So when you launch w/ debug, its going to launch whatever is defined in your Cloud Service (.ccproj) project. This mimics Azure 100% which is why it occur, but I can definitely see where your scenario would be helpful.
Few options, based on your needs.
If you need to test azure-specifics (aka it has to run in the emulator)
Create a second solution file, create a new Cloud service in here, add your project. I like this option because the projects/roles themselves remain untouched.
What Stuart suggested before me, create a second Cloud Project, set as startup, run that.
Similar to above, create a second project, but don't worry about startup. You can right click on any project, go to Debug and select start w/ debugging and achieve what F5 does without binding F5 to this solution
If you dont need to test azure-specifics (ie you are just testing the role)
Right click on the role's project, Debug, Start with Debugging This way the whole solution remains intact and you are just testing the logic
I think you can do this by:
create a new Azure Cloud Project within your solution
add just the one worker role to that cloud project
set that cloud project as your startup project
This will single out just the worker you are interested in
An easier solution would be to open the ServiceConfiguration.cscfg file, and set the "Instances > Count" property to "0", for all the roles that you don't want running (this only works in the compute-emulator, and NOT on the azure cloud).
That way, you keep your solution intact and your configurations safe, while just omitting them from the compute-emulator during run-time.
Related
I have an azure website running as an App Service which I publish to Azure from Visual Studio. I have multiple webjobs which are all linked to the main web project.
When I add a new webjob it fails because the wrong RUN COMMAND is attached to it. For instance, the webjob QuarterHrsWebJob fails because it has somehow been set up with a Run command of "doctap.exe". doctap.exe is the exe belonging to a different webjob (called doctap) - but somehow it has been assigned to QuarterHrsWebJob as well.
See screenshot showing "Run command: doctap.exe" for the QueryHrsWebJob.
Many thanks for your help.
Do you have a project reference to the project containing doctab.exe from the QueryHrsWebJob? I was able to reproduce the problem you are seeing by creating a similar reference between two Web Jobs.
If you do not have a reference like this, could you please share the project file for both affected Web Jobs and your webjob-publish-settings.json files?
Short: How do I create a publish profile in Visual Studio that deploys a deployment slot vs production slot?
Long: That moment when you get a Sev1 call saying that Production is busted and you know that minutes before you just fired off a deployment to your integration deployment slot. Yup that's what just happened to me and for the life of me I can't explain it.
So we have one deployment slot for our Azure Function app named "Int". When creating the publishing profiles, I simply used the "Create new profile" wizard in Visual Studio and chose "Select Existing" Azure App Service, and then drilled in on the "Int" Deployment Slot. Seemed pretty straight forward. Well doing so causes both Int AND Production to be deployed. This was certainly unexpected and obviously catastrophic.
After some digging in the Portal I found in the "Overview" section of our Azure Function app there's a "Download publish profile" button. Clicking it for Production as well as for INT yields two separate files with different users, destinationAppUrls, etc. The only thing that was the same between the two was the FTP publishUrl but I assume that the server would route to the appropriate root based on the credentials passed in.
As it stands in spite of the fact that I have two unique publish profiles, one for prod and one for int, deploying either of them updates both production and our deployment slot.
Here's a list of the things I've tried to fix this myself to no avail:
Deleted both publishing profiles from Visual Studio and recreated them via the Wizard.
Deleted both publishing profiles from Visual Studio and recreated them via the downloaded profiles from the portal.
Deleted the INT publishing profile, created a new FTP user in the portal for our INT deployment slot, updated the downloaded profile for INT, then imported it into Visual Studio. <== Honestly I think this was dumb because I don't think VS is using FTP to deploy. I could be wrong though.
Ensured AutoSwap is turned off.
Used an FTP client to manually login with the publish credentials. Turns out even though Production and Int have different "FTP Deployment Users" logging in as either points at the same location. (This ultimately seems to be the problem)
Clicked "Reset publish profile" on the deployment slot and re-downloaded profile.
Other than losing the autoswap feature which I'm not even losing, I suppose one way to work around this would be to create an entirely separate app thus forcing it to work properly. I really want to avoid that if possible though.
Thanks in advance for help here.
That shouldn't happen, but if I had to guess, you must have the same values for WEBSITE_CONTENTAZUREFILECONNECTIONSTRING and WEBSITE_CONTENTSHARE defined in both apps. The former is the storage account where your app content will be saved, and the latter is the share name in that storage account. It's fine for both to share the same WEBSITE_CONTENTAZUREFILECONNECTIONSTRING, but if you also share the same WEBSITE_CONTENTSHARE, then you'll end up with the odd behavior you're seeing.
Usually when you create the function app through the tooling it should create a new share with a random name for each app. If you deploy using an ARM template or some other method and set these both to be the same you'll run into that behavior.
This page shows how to enable profiling from the Publish Windows Azure Application dialog.
How can I configure profiling without using that dialog?
I looked through my service configuration and service definition files, and I can't find any settings related to profiling. The checkbox and radio buttons in the Publish dialog has to be configuring some setting file somewhere; I just can't find it.
I found it. Profiling is indeed configured in a settings file somewhere.
In case anyone has this same question, here's the answer:
Inside the Azure project directory, there's a folder called "Profiles". Inside that folder are some .azurePubxml files that (it looks like) correspond one-to-one with your service configurations.
Inside those files is a setting <AzureEnableProfiling>True</AzureEnableProfiling> that can be set to True or False.
So that's how you can turn Profiling on and off, without needing to use the gui tool for publishing to Azure.
I wrote a "Hallo world" type Windows Forms application in C# to test authentication issues. I'm going to be running the eventual application from a server periodically, so I want to be sure I can get to the resources, and fix that before committing to the whole application.
So, in Visual Studio 2010, I choose Publish....
It says "Where?", and I specify a folder on a shared file system.
It says "How will your users install", and I say, "URL" or something like that.
It says "Where", and I give it a URL in the same shared file system, different folder.
All is right with the world....
Now, I install it on my server by double-clicking "setup" on the shared file system where I published the application.
Now, I find a shortcut in my start menu, all good.
Now, I want to set it up so SQL Server Agent executes it periodically (and tests authentication...) so, what is the URL I give it to execute? I've been trying everything, but not going so well. I don't understand the publish method much at all....
How can I fix this problem?
Look at the Start menu shortcut for your installed application and you'll see that it points to a "ClickOnce Application Reference" (.appref-ms) file buried deep within your user folder. You can start the application by executing that file.
Example:
Process.Start(#"C:\Users\Igby\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Microsoft\MyClickOnceApp.appref-ms");
I don't know anything about SQL Server Agent, but try giving it this path.
I would like to simultaneously start multiple instances of a project using Visual Studio. By pressing F5 (Debug -> Start Debugging), at most 1 instance of each project in the solution starts, respectively. I didn't find a way to configure startup of multiple instances of the same project.
The project in question is a console app that is difficult to convert in a way to enable multiple instances within the project.
Well, if you are looking for simultaneously, I don't know.
But you can try right Click on the Project Debug -> Start new instance as many times as you like.
If you don't need to debug you can start multiples instances ("Start Without Debugging")
In case you want to debug an instance you could then attach the debugger to it.
If attaching the debugger is not an option you could use System.Diagnostics.Debugger.Break() method in your code. The equivalent but programmatically.
It's not possible to debug multiple instances of a project using a single project. The IDE/debugger need to synchronize program execution with source code and debugging symbols; it can't do that unless there's only one instance.
You could, however, copy your project multiple times and start them as you describe (as a solution).
Select and Right click any project. Then debug and Start New Instance