Visual Studio debugging is not attaching to WebDev.WebServer.EXE - visual-studio

I have a solution with many projects. On Debug, I have three web projects that I want to start up on their own Cassini ASP.NET web development servers. In the solution properties → Common Properties → Startup Project, I have multiple startup projects chosen with the three web applications' Action set to Start. All three web development servers start, and all three web pages load.
However, Visual Studio is only attaching to two of the WebDev.WebServer.EXE processes. I have to manually go attach to the third process in order to debug it with the debugger.
This behavior just started happening, and I'm at a loss as to how to troubleshoot this.
Also to note, I have stopped and restarted the development servers several times with no change in behavior. Also, when attaching to the process manually, I see that the Type property of the two automatically attached WebDev.WebServer.EXE processes is Managed, while the Type property of the unattached WebDev.WebServer.EXE process is TSQL, Managed, x86. When looking at the project's properties, however, I am targeting AnyCPU, and do NOT have SQL Server debugging enabled.
The two projects that attach correctly are C# web applications.
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
The project that is not attaching correctly is a VB.NET web application.
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
The behavior is the same on another workstation. So odds are that it's not a machine-specific problem.

This might be a shot in the dark, but I would look at the csproj files, to see if the one that isn't working has any obvious differences. In particular, I would look for a <ProjectTypeGuids> element. Anything that relates to web-hosting is of interest too, of course; so anything under:
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
(or similar, depending on your flavor of project; compare between the 3 for anything that looks out of place)

Right click on the main solution -> Properties -> Common Properties -> Start Up Project ->
Make sure it's set to "Multiple startup projects" and all are set to "Start" instead of none or start without debugging.
Also double check each projects .user file and make sure AlwaysStartWebServerOnDebug
is set to true along with any other debugging options.

I set multiple startup projects and choose each of the web applications in the properties of the solution (Right click the solution in Solution Explorer → Properties).
Is the third project an IIS web project (set in properties)? We have numerous IIS projects that run together and we don't have any issues debugging.
Try solution → Properties → Configuration Properties → Configuration and see what projects get build and when.

Not sure what the problem might be, but when I've had problems with complex projects before I've found it helps to look at the .vbproj or .csproj files directly.
Have you tried creating a new VB.NET project and simply copying over the files from the non-working project?
I'd also try adding a 4th, very simple C# web application project to see if perhaps 3 is some sort of magic number for your configuration (though I'm currently working on a solution with more than 3 and have no problems debugging). You could do the same with a simple VB.NET web application - you'll know then whether it's a problem with webserver #3, VB.NET in general, or your specific project.

Is debugging enabled in the Web.config file of the web application? Is it set to Debug mode when you start it in Visual Studio?

Related

Unable to Debug a Website in Visual Studios

Here is my situation...
I have to maintain a website with multiple applications. We no longer have any of the solution files and the code is deployment code (so it uses DLL's instead of the original classes).
I basically grab the code from the website and stick it in a Visual Studio projects folder (This is generally C# code with Javascript that was originally developed on VS). I then open Visual Studios's 2010 Professional (VS) and open website, using the path in the project folder. I then add references to all the DLL files and if all the includes, images , and css files paths are referenced correctly, I can hit F5 and get the webpage to appear with some functionality. This creates a Project file in the Projects folder which I can then open instead of opening a website.
The problem is that I am unable to debug. If I set a breakpoint, it goes from solid red to outline red upon start of debugging. The standard message is "The breakpoint will not be currently hit. No symbols have been loaded for this document".
I have cleared out the symbols and reloaded.
I have debug = true in all my Web.config files.
I have gone into project properties and set the startup project action to "Start".
Any ideas why I can't debug ? My other projects that I develop from scratch work fine, but it is these projects that I am trying to get working from website files that won't debug.
My goal is to get every one of the Website apps under VS control were I can fix bugs and make improvements. Not very easy when the original source code is no longer available.
Please Help !
Thank You,
Eric
I fought this issue for a half of a day. I'm currently maintaining a website application. What worked for me is going into the project's Property Pages >> Start Options and changing the server to "Use Custom Server". I believe this setting will use IIS and not IIS Express. I started the project and was immediately able to debug.

many websites under one solution

I have many websites under one solution for documentation purposes. I build these small websites for prototyping new concepts that I've learned.
The problem is whenever I try to debug one of the stand-alone websites Visual Studio will start Cassini for all the websites under the solution.
I know I can create a new solution and just bring in the projects as needed but I was just wondering if there was another way to be able to see all my WebSites and debug anyone one of them at anytime without starting up Cassini for all websites?
In Visual Studio, right-click on the Solution (not on a project), and go to Properties. Select Configuration Properties from the window on the left and untick the Build and/or Deploy properties for the projects that you want to ignore.
I ended up just making them individual solutions and just organzing my directory and making the directory names more descriptive.

Disabling the *.vshost.exe and miscellaneous files from being created on build

I found the following information about the Microsoft Visual Studio "extra" files:
What is the purpose of the vshost.exe file?
My question is, is there a way that I can NOT have the .pdb, .manifest and vshost.exe files from being made? Or are they absolutely necessary?
I just noticed that after debugging it, it's still showing up as a running process in my machine which worries me since I already closed it.
Switch to the Release configuration. Then Project + Properties, Debug tab, untick the "Enable the Visual Studio hosting process" option. Build + Clean, you can delete anything that's left and it won't come back. That this option is turned on by default for the Release build is, arguably, a bit of a flaw but defensible.
The hosting process is a custom hosted version of the CLR. Exactly what it does is not well documented but it is related to configuring the security settings of the primary AppDomain. I've never heard anybody complain about battling CAS problems without it, but then it is unusual to turn it off and your app almost always runs in full trust when debugging from the IDE. It would matter if you build to a network share on early versions of .NET. The only thing that's obvious from disabling it is that anything you write with Console.Write in a gui style app will no longer appear in the Output window. It has nothing to do with speed as claimed in the highly upvoted answer in the link, the core framework DLLs are already resident in RAM since VS and MSBuild uses them.
Best thing to do is just not worry about it too much. A Setup and Deployment project will ignore it.
Regarding vshost files, at least in VS2010:
They are not generated on build, but on selection of build configuration (it will be generated in release when we select release for the first time) and on setting "Enable the Visual Studio hosting process" to true. (As configuration debug and this option set to true are defaults, vshost.exe will be created in bin/debug on opening VS with target project by default.)
They are not cleaned on rebuilding or cleaning the project, but only manually when "Enable the Visual Studio hosting process" is false if VS with that project is open. (And it won't be generated anymore when opening this project.)
If this flag option is true and VS with target project is opened, this file cannot be deleted as being used. Once when it is unchecked, vshost.exe can be immediately deleted.
Summary: Generating and removing these files is not related to build process.
Also, I may add that option "Enable the Visual Studio hosting process" in referenced projects which are class libraries is not considered. This option is only considered for target project which generates executable file.

Running two projects at once in Visual Studio

I created a solution in Visual C# 2010 Express that contains two projects: one is the client, the other is the server. I would like to debug both at the same time, but I can only seem to run one of the projects during debugging.
Is there a way to run both at once?
Go to Solution properties → Common Properties → Startup Project and select Multiple startup projects.
Max has the best solution for when you always want to start both projects, but you can also right click a project and choose menu Debug → Start New Instance.
This is an option when you only occasionally need to start the second project or when you need to delay the start of the second project (maybe the server needs to get up and running before the client tries to connect, or something).

I don't get the concept of Visual Studio Projects and Solutions

In Eclipse, I have a workspace that contains all of my projects. Each project builds and compiles separately. A project does not interact with another project.
How does this relate to Visual Studio and Projects/Solutions there?
A VS project is it's own entity. It will build and compile by itself. A Solution is just a way to contain multiple projects. The projects don't necessarily need the other projects to compile (though, they can depend on the other projects).
This just lets you conceptually group projects together into one Big Project. For instance, you can have a separate testing project. It depends on the code from the actual project, and should be kept together with the actual project, but it does not need to be in the same exe/dll.
Each VS project builds a single EXE or DLL. The solution is just a collection of related projects.
So VS project:Eclipse project::VS solution:Eclipse workspace.
Another way to look at it is, a solution is a container for projects. For most of my work , I create each tier as a project within a solution so my tree looks like:
My Web App or Win App
Presentation Layer
files...
Business Layer
files...
Data Access
files
Your mileage may vary
#Thomas Owens:
Yes, some (most?) people using Eclipse have more than one workspace. It's what surprised me the most when I first started using Eclipse, so I'm replying here to make this comment more visible.
The thing that may be throwing you off is the following:
In VS2003, everything had a Project file and a Solution file. If you had a Solution with one Project, you could open the Solution and see the one Project. If you opened the Project, it would try and create a new Solution file to contain the Project. But web projects and Winform projects all had Projects and Solutions.
In VS2005 this changed a bit - by default now, Web projects no longer had Project files. They had received feedback from some web developers that didn't like Project files - their take was that if a file is in the directory, it's part of the app. After VS2005 shipped, they got more feedback from developers who did like the Project file notion, so they patched it back in. This is "Web Site" versus "Web Application" in VS2005 (and I can't remember which is which now).
In addition, in VS2005, if you have a Solution open with only one Project, you won't see in the Solution Explorer that there's even a Solution at all, you'll only see the Project (as if it was not in a Solution). Only after adding the second Project will you see that there's a Solution containing them both.
So basically you were on the right track - Solutions and Projects work the same in Visual Studio as they did in Eclipse, it's just some quirks that make things confusing.
A Solution has 0 or many Projects...
There are way too many kinds of web projects in Visual Studio 2008. There are Web Site Projects vs. Web Application Projects and they limit you in different ways. It's a good example of Microsoft providing too many choices instead of focusing on one strong solution. Even within the Web site Project option, there are at least 3 different ways to compile your application.
I found that not always seeing the solution in the Solution Explorer to be irritating. There is a setting in Options->Projects and Solutions->General called "Always Show Solution" which was handy.

Resources