I wrote a Client that will connect to my WCF service, and the service will able to handle multiple client application connections.
So when I first start testing it, I configured Visual Studio to start multiple projects to start up both my client and WCF service project in Visual Studio.
Then because I want to test if it works when I have multiple client applications connected to my service, I start up another client application manually (double...click on exe).
So yeah, of course the client application that I started up manually won't be able to debug in Visual Studio, and it does have strange things goes on. So is there any advice for debugging in situations like this?
You can launch the additional clients separately, and then in a new instance of Visual Studio (with the project loaded), go to the Debug menu and select "Attach to Process" to start debugging the new client.
There is the option to set multiple startup projects:
In Solution Explorer, select the solution (the top node).
Choose the solution node's context (right-click) menu and then choose Properties. The Solution Property Pages dialog box appears.
Expand the Common Properties node, and choose Startup Project.
Choose the Multiple Startup Projects option and set the appropriate actions.
Anyway, I often debug LoB apps consisting of server and client and come across this compelling necessity all the time, when I only want to debug one of them while keeping the other on between sessions.
What I do is I first set the current startup project using the top toolbar (see screenshot) to the insignificant one (if I'm currently working on the client, it would be the server, or vice versa), then "Start without debugging" (Usually Ctrl+F5).
Then, I switch the startup project to the client I want to debug, and hit F5 or other debugging method I'm interested in.
Somewhat tedious, but it's the quickest and works for me the best so far.
There are some petitions to Microsoft to make this feature easier so that they should add a command like "Start instance without debugging", so that you don't have to set the startup project back and forth all the time. Please vote here, and here.
Related
In visual studio, I have a WCF project which is ran in a local IIS server, and a client project that I want de debug. Then I launch the WCF project in debug mode, close it in VS (it stays opened in the windows task bar), put my breakpoints in the client project, and then launch debugging of the client project.
I have to tell you that the client is given a list of files that it parses one after the other.
It seems to work well, but after an given amount of time (a few minutes), the following file enters in the debugging. sorry if it is not very clear, I try to explain it the best.
To explain it in more details, The files are provided to the client, and each file is first treated by an entry method, say A(). I have a breakpoint in the first line of A(), and while debugging this method and those which follow, suddenly, after a "F10" (one step ahead), the cursos go to the A()'s breakpoint and the 2 calls of A() are concurrent.
I tried to launch the web service in RELEASE, but then I can't launch the client(a visual studio message box complains the service isn't in debug mode).
Do you know a way to run both projects but only debug the client?
thank you.
Select the solution in Solution Explorer and then select the Properties icon in the toolbar, or right-click the solution and select Properties.
On the Properties page, select Common Properties > Startup Project.
If the server does not need debugging, set the server project to "Start without debugging" and set a breakpoint on the client, then start the project.
If you want to know more about debugging in VS, you can refer to the links below:
https://learn.microsoft.com/zh-cn/visualstudio/debugger/debug-multiple-processes?view=vs-2019
I have an exe that is a 'server' and exe that is its client.
I would like that when I hit RUN (F5):
server starts
client starts with debugger attached
Any good ways to do it?
If you have Multiple projects in One solution and you want to start more than one then,
Right Click on Solution ->Properties ->Common Properties->StartupProject->Select Multiple Start Up Projects ->Set the Sequence.(suitable For WCF like Scenario When Server and Client should start together, but in same IDE instance for debugging)
Other Ways
Right click on Project ->Debug->Select Start External Project-> Enter the Path.
Go To tools menu And click on Attach To Process.
Right click on the project in the solution explorer, thene select debug->run new instance
I just starting working with Visual Studio and I find that debugging web apps is rather annoying. After making a change and clicking f5 it sends you to localhost:port/ however many times you are not editing localhost:port/ but you are editing localhost:port/someOtherFile, so you can see how this can be pretty annoying.
I am hoping that there is a way to optimize this. Ideally I would want to be able to hit f5 and have it just refresh whatever tab in my browser has localhost:port/whatever/youGetThePoint If this is possible it would make for some really nice debugging because many times you would never even have to click the browser.
Also, why do we have to hit shift+f5 to stop debugging. Why not just f5...
EDIT: I am using MVC2
In Visual Studio, right click on the file (Mypage.aspx -?) you want to start debugging with and select "Set As Start Page."
This will automatically open that page instead of root.
Click on your application in the solution manager
View -> Property Pages
Select the 'Web' tab on the left
Set 'Start Action' to a specific page.
You can select any page in the web project to be the startup page - once you click F5, the browser will start at that page.
Two things you can do:
You can set your web application to use your local IIS for debugging. I'm assuming you're using the standard settings that get setup whenever you create a new web app project.
To set your project to use IIS first make sure you have IIS installed on your dev machine. Select the web application project from the Solution Explorer and then right click. Hit the properties selection. The first tab on the right (build), should allow you to configure IIS to have an application for your project. It will eliminate the port number part and should be a bit easier to navigate around in.
Second thing you can do is find the page you want to go directly to and right click on it and set it as the start page ("Set As Start Page").
Also, you can Google for a Visual Studio macro that will attach to the IIS worker proc so you don't have to refresh what the browser is currently doing. You can also go to the debug menu item and select "Attach to Process..." and then find the worker proc and attach to it.
I believe Start Options might do the trick for you.
Right-click on the project, and select "Start Options..."
On the Start Options dialog under "Start action" heading, you may specify a page or start URL.
Background: I have a Visual Studio 2008 solution containing three different web application projects. If I right click on the solution, choose "Set Startup Projects.." and then choose "Multiple Startup Projects", I am able to fire them all up at once when I hit F5 (Start Debugging).
Desired Behavior: What used to happen (until it unexpectedly stopped working) was that it would automatically open up three browser instances (IE by default) and run each of the web apps in each of the three browser windows.
Current (Undesired) Behavior: All of a sudden, instead of opening three browser windows, it now opens a single browser instance and sequentially starts them all up with the exact same window/tab, which means that I am left with only one app actually running. (Whatever the last app it was that got started.)
Any idea what could cause this? I've checked my project and browser settings (including the "Reuse windows when launching shortcuts" option) and can't seem to figure it out. Any ideas?
Update: I changed Visual Studio's default browser to Firefox, and it works as expected by opening up multiple browser windows. I guess I'll just use Firefox when debugging for now, which is probably a good thing anyway.
I don't know why it had stopped working but rather have a suggestion: Check 'Don't open a page. Wait for a request from an external application.' option under 'Start Options' page of your Web project property pages. It specifies that Visual Studio won't open the browser window automatically. It should start your project in a Web server and wait for another application to make a request.
This seems to be a bug/feature in newer instances of MSVS and/or IE.
It happens in Visual Studio 2013 and 2015 as well, and might not be a bug as such, but can certainly be an undesired behaviour.
To reproduce:
Select 2 web projects in multiple startup projects.
Set one to Startup and the other to Start without debugging.
Only one browser tab is used, but you will see the tab used briefly by each project before the next one is loaded.
The problem is that the last loaded project is not necessarily the project you want to have in the browser.
An other workaround is to simply set both projects to Start.
It turns out using Firefox did the trick for me. Since there are no other answers, I will just accept this one.
Starting with 2005, VS started this behavior of when starting debugging session it spawns up a webserver for every project in a solution. I have a solution with 15 projects so it takes a while and is a waste of resources. Is there a way to configure it differently besides just using IIS?
Some details here on why it does it and how you can overcome it:
http://vishaljoshi.blogspot.com/2007/12/tips-tricks-start-up-options-and.html
There are instances when you might have many web applications or web sites in the same solution and you may be actually debugging only one of them... In such scenario it might not be desirable to have multiple instances of ASP.NET Development Server running... VS provides an explicit setting in the property grid of web application/site called Development Web Server - "Always Start When Debugging" which is set to True by default... If you set this Property to be False only one web server instance will be created for the start up web project...
Set the web service project's "Always Start When Debugging" property to false. To get to the property, click on the project node and then hit F4 or click View | Properties Window (not Property Pages).
Be careful: this is not in the properties you reach by clicking the project node then clicking Properties; or by double-clicking the project's Properties sub-node; or by clicking View | Property Pages.
Also annoying is that this is property only persists as a user setting, in the .csproj.user file.
I know this is an old question, but in Visual Studio 2010 choosing properties from a web project brings you to the big configuration screen/grid. The Always Start When Debugging setting is buried a bit.
With focus on the desired web project look at the properties window/tab (CTRL+W, P)and set the property there.
In Visual Studio 2008, there is an entry on the Properties page for the project called "Always Start When Debugging".
Note you have to get to this by selecting the project and going to the Properties pane (or right-clicking Properties). This option is not present when you double-click the project and open it in the main editing pane.
VS by default sets this value to on for all your web projects. Turning it off will solve this problem.
[editorial]This is fairly annoying and I wish the default were false![/editorial]
I have also been highly annoyed by that behavior. The only solution I have found is to manually change the properties page for each web appllication so it hits a real running instance in IIS.
I prefer this anyway, because debugging with the integrated web server can give you a very false impression of how your application will interact with the IIS security model.