I have a statesless Service Fabric service
I am deploying it within my application into a 1 node dev cluster
None of my breakpoints ever get hit
I have rebuilt, restarted, updated visual studio and I am now really out of ideas
Has anyone ever seen this?
The strange thing is that my breakpoints stay active
I know my logic is being executed as messages are shown in the console
Paul
Linking the answer in the comments
https://stackoverflow.com/a/42118286/5946937
Close all Visual Studio windows.
Restart the Service Fabric service: Type services.msc in the windows run tool. Find Microsoft Service Fabric Host Service. Right Click + Restart.
Reset the local cluster: Look at the Service Fabric Local Cluster Manager Icon in the notification area in the right side of the task bar. Right Click + Reset Local Cluster.
Open the problematic solution in Visual Studio.
Clean and Rebuild solution.
Finally run your solution (press F5).
There is one other thing that I noticed. After pressing an F5, on the process tab, keep an eye on the process id (this is just a sample reference, not from a service fabric process), in my case, there were no processes attached at all. In such a case, go to Debug -> Attach to Process -> Choose the process you need to debug.
One thing to keep in mind is that sometimes you may have to select the show process from all users checkbox because visual studio may be running in admin mode but the application process maybe running in normal user mode.
You can also understand that the right process has not been attached when you see something like this in front of the breakpoint. This is also an indication that the right process has not been attached. If the right process has been attached, the debugging should be successful!
Related
I currently found an issue that one of my projects, which is a windows service, stops immediately after it starts. It was not like this before.
Worse still, I am unable to attach the service to Visual Studio since it stopped immediately after it started.
My system is Windows server 2012 R2 and Visual Studio is 2013.
Is there any way for me to debug the service?
You can start the service directly under debugger. To achieve this you can either modify the service start command (sc config binPath=) or you can use GFlags to alter the service image to start under debugger. In both cases your debugger will be in the background and you'll need to then remote into it.
But usually you can solve the issue from dumps, if any. Often simply starting the service executable from the same account as the service will reveal the issue.
Finaly lets not forget the power of printf. Add logging and isolate the issue from the logs. Your service should be doing this anyway.
I have just found an answer in MSDN.
https://msdn.microsoft.com/en-us/library/cktt23yw.aspx
Add the following code:
System.Diagnostics.Debugger.Launch();
At the very beginning of OnStart method. Then run net start serviceName (administrative credential is needed)
I am trying to run a specific Web Project in a way to receive requests from an external application.
So when pressing F5 it starts the current Web project in visual studio with debugging but waits from the other site for web calls.
The problem is that for the other web site to work i have to launch several other sites, with services, resources, auth server etc. Some are not part of the solution - which means I cannot use "Always launch when debugging".
For that I have the executable that you can see grayed out in the "Start external program" section. The "IISExpressRunner". This program will also open the site that will access this one after everything is setup.
My problem is that I currently need to run that manually every time I start debugging because both options cannot be selected at the same time - which of course does not make sense since it can debug only one thing.
I can debug the WebSite via the IISExpressRunner application alone, however that has the implication that I need to run VS in Administrator mode, since the app requests UAC to be able to disable IIS to run IISExpress on port 80 - specific for domain alias and authentication server redirects for Google and Facebook logins - to be able to run it locally in the dev environment.
So is there a way to have Visual Studio debug the current project and automatically after debug has started to also execute this external application without debugging it?
A workaround I could think of is that you could call the bat file before you debugging the app using code "Debugger.IsAttached()".
Run batch script before Debugging
There is a manual process you can use. During running a debugging session, right-click the project you want to also start debugging, go to the Debug submenu, and click Start New Instance.
I have a simple WCF service hosted by IIS and am running into the classic problem of not being able to load symbols or hit a breakpoint when remotely debugging, although I believe I am doing everything correctly. Here is a simple sequence of screen snapshots of the steps I'm following; could someone with a sharp eye please point out what I'm missing?
The dll for the app rests in the indicated directory here, with its own app pool as shown:
And that folder, containing the dll and pdb for debugging info, looks like this:
I start the Visual Studio remote debugging monitor (as an admin) on the remote machine:
On my local machine, where my code exists, I go to Tools | Attach To Process, and navigate to the remote machine, and pick the w3wp.exe process for the service pool hosting my application:
Back on the remote machine, the VS debugging monitor shows I'm connected:
But on my local machine, no debugging information is available. And yes, I am absolutely positive the code that has been built locally was a debug build and exactly matches what was moved to the remote machine:
NODOTS had the answer to the problem in his/her comment. I'm not sure how to mark that comment as the correct answer and show a screen snapshot, so I'll do that here.
I needed to have "Managed (v4.5, v4.0) code" selected as shown, circled in red, in the following screen snapshot. Many thanks to NODOTS for the solution.
I can't run the Windows Azure Hello World sample. It gives me the following error:
"Start role failed for one or more roles".
I put the project in the root of my D drive to be sure that path length is not an issue. I also cleared the Azure temp folder.
I am using the newly released version 1.4 of the SDK.
One common cause of this problem is that the development fabric (also known as "compute emulator") isn't running as Administrator on the local machine. If you manually start the compute fabric, this may be the reason. If you start the compute emulator from Visual Studio (e.g. by pressing F5), it will start the compute emulator running as administrator provided the VS instance is running as Administrator (you have to right click VS in the Start menu and select "Run As Administrator" to run it that way).
Another cause is that the web role is the startup project rather than the Azure service. The Azure service (the one with the .cscfg under it) has to be the startup project (right click on it and select "Set as Startup Project").
Sounds like you have an exception in the OnStart method of one of your Role(s). I would:
1) Make sure that all exceptions are handled
2) Start logging the exceptions or put a breakpoint to see what's happening
I am attempting to debug a RESTful WCF service I've created using a web browser as my client. Initially things go well however after stopping the debug session and making some changes to my code when I restart it's as if the old code is still being run. My breakpoints are ignored and it's as if a process is not being stopped.
I am running the service within Visual Studio and here's the URL I am asking the browser to retrieve:
http://localhost:25000/IntegrationService.svc/DeskQueue/tophd
It's clear the proper method is being called but the breakpoint I have at the top of the method is being ignored. Is there some external process I need to stop?
Thanks for any help.
Maybe it would be more convenient to deploy your service on IIS (Project settings->Web->Use Local IIS Web server, Create virtual directory) and then debug the service from Visual Studio (Debug->Attach to process->w3wp.exe).
You need to kill Cassini (the WebDev Server) as it's holding on to your older built WCF Server code....it doesn't automatically reload the newer DLL.
There are a few options:
You can manually stop Cassini by looking in your Notification area for the "ASP.Net Development Server" icon (yellow with world inside) and selecting Stop (via the context menu or Dialog).
You could install the Visual Studio addin KillCassini, so you just have to press a key combo to kill the server when you wanted it killed
http://visualstudiogallery.msdn.microsoft.com/1269c9a1-fcfe-4b47-91e7-22c7027f3c41
You could turn on Edit-and-Continue, so that it restarts a new Cassini the next time you Debug
Automatically stop/restart ASP.NET Development Server on Build
If you have some really exotic debug/test/run cycle then you could leverage a drop-in compatible replacement for Cassini that comes with source code.
http://cassinidev.codeplex.com/