SharePoint 2013 - Set as startup project breaks debugging - debugging

I'm using Visual Studio 2013 and I create an App for SharePoint with Provider Hosting (MVC). I then immediately put a break-point on the Index of the Home controller and click play, break point gets hit all is good :)
I then right click the SharePoint app and set as start up project. Then I run again and my break-point doesn't get hit.
To get debugging back again I have to start a new debug instance of the MVC project and then start a new debug instance of my SharePoint app.
What's going on?

As a work around to this problem you shouldn't set the startup project by right clicking, instead follow these steps:
Right click your solution -> select Properties
Select the Multiple startup projects option
Set all your projects action to None
Now go ahead and set your ASP.NET (Provider hosted web app) to Start
Next (if you have multiple SharePoint apps) select the one you are currently working on and set its action to Start
Now when pressing F5 your breakpoints will be hit inside your provider hosted app.

Related

How Could I Debug 2 Application at same time in VS 2012?

I have Solution that contain 2 projects
1- Windows App(contain Form)
2- Web App (Contain Default.aspx)
and i want them to open at same time
How could I do this ?
Here is another scenario. You set your Web App project directory as virtual directory in IIS and it runs. You can go http://localserver/..../default.aspx... Then you can run your Windows application by pressing F5 if it is set as startup project, or go to project-debug-start new instance. At this point you debugging your windows app. Now, go to tools-attach to process and attach to your web application process. Voila - you debugging both applications/projects at the same time.
One way would be to open a second Visual Studio instance, debug the Windows App with the first instance and the Web App with the second instance. Keep in mind that this costs some performance on your PC.

How can I find out what debugger is attached to w3p.exe

I'm trying to setup debugging on a class ASP project in VS 2010, and in doing that am trying to attach it's debugger to w3p.exe. I'm using Windows 7 64-bit and IIS 7.5. I've used this method successfully a few times before on another machine.
However, I'm finding that this time I am unable to attach the debugger. It's saying:
Unable to attach to the process. A debugger is already attached.
But I can't figure out what it might be. How can I determine this? Or could it be something else? I've rebooted my PC and can't yet see signs of anything running which looks like a debugger.
Setup
In case it helps, here's the steps I used to setup the environment, which I documented from my previous successful attempts:
Created new empty Visual Basic .NET Web (Best to create in C:\inetpub\wwwroot\, otherwise you will have security/ACL issues when loading the site).
Copied the contents of site folder to project folder.
In solution explorer, selected to show all files not in project. Selected all files and right click and select: "include in project".
Under project properties -> Web -> Set to use IIS and start with URL http://mysite.local
In hosts file pointed mysite.local to 127.0.0.1
In IIS setup new website pointing to the files with a host header of mysite.local
Go to application pools, ensured mysite.local was set to classic mode. No managed code.
Under ASP -> Enable Parent paths and make sure server-side debugging is enabled
Under error pages, make sure full details are shown.
Debugging in Visual Studio 2010
Run VS 2010 as Administrator
In your project, use Ctrl+F5 to run without debugging
Now, in the menu go to Debug -> Attach to Process -- This is where I fail
Tick show processes from all users AND show processes in all sessions
Make sure it is set to automatically determine type of code to debug
Look through the w3p.exe processes in the list, and based on the IIS POOL\site name, pick the right process.
Set your breakpoints and refresh -- debug as normal.
Are you having some Debug Diagnostics Tool running on your machine. Sometimes back i had the same problem the Debug Diagnostics Tool was debugging my w3p process.

Debugging ASP.NET website from Visual Studio causes restart of the website

Somehow, since some time I'm experiencing problems with debugging my ASP.NET website.
Every time I try to debug the website ASP.NET shuts down (global.asax_Application_End is called).
I believe this is triggered because the site is built by Visual Studio. However, manually (re)build the site and then start debugging also restarts the site. Even debugging and ending the debugging session, clicking a couple of buttons on the site to get to the desired state, and start a debugging session again still triggers a build action, which causes the site to restart.
Since restarting resets HttpRuntime.Cache booting the site takes a long time, and sometimes I want to debug some situation that involves caching.
Now there is a setting on the website's property pages:
Start Action (F5):
Before running startup page:
No Build / Build Page / Build Web Site.
I've set it to No Build, restarted Visual Studio, but still it triggers the build action every time I hit F5 or the Start debugging button...
Anyone any ideas as to how to resolve this??
Thanks,
Jaap
We've solved this by converting our project to a Web Application instead of a Web Site. This had some impact on our architecture since we had some classes in app_code which we needed to use reflection on during site startup.
It turns out that the Web application in combination with "Use Custom Web Server" fixed out issue!

Problem with Classic ASP Breakpoints in Visual Studio 2005

I am trying to set a breakpoint in an ASP page that isn't working correctly.
I am doing this in visual studio 2005 on Windows server 2008.
Whenever I try to set the breakpoint with the mouse, the IDE opens up a different page and sets a breakpoint somewhere in that page. I don't know why it is doing this.
I have better luck setting the breakpoint using F9, but those breakpoints don't get hit, anyway. The breakpoints that are set in the page that visual studio opens automatically are getting hit, but this doesn't help me, because I don't need to debug that page!
This is my first time debugging classic ASP, so I could use some help.
Thanks
I've just tested debugging of classic ASP in VS 2008 on server 2008 and it works fine. I haven't got VS2005 to test it on that.
However if memory serves I've seen this problem when the root folder for the web site project (and you are using a web site not a web application project right?) and the Home directory path in the IIS configuration. E.g., the VS solution points to an UNC path whereas the IIS points to a physical drive. In this case VS can't marry up the file path of the script in the ASP process with the file path of source code in the solution.
In VS.NET:
project - properties
configuration properties
debugging
- enable ASP debugging
- enable ASP.NET debugging
In the IIS snap-in:
default Website - properties
home directory tab
configuration
app debugging
- enable ASP server-side script debugging
Website (the project you want to debug) - properties
directory tab
application name: add
Add IIS process account to Debugger Users group:
In Computer Management snap-in:
System Tools
Local Users and Groups
Groups
Debugger Users - properties
Add user IWAM_machine-name (the "Launch IIS process account")
Now, to debug in VS.NET:
right-click the .asp page that the application should start from
select "Set as Start Page"

Debugging a site using web service with Visual Studio 2008

I've got a solution with many projects
One of these proejcts is a "MyProject.Web" web application.
This has a web reference to MyProject.WebService" project -
I have a breakpoint in the WebService project, and i call the method on one of my Web forms, the break point is not hit....
How can i enable this?
Right-click on the solution and choose "Set Startup Projects". Choose to start multiple projects and select both your web site and web service to start with debugging. Then when you start the debugger they will both fire up and you should have full debugging in both.
I ran into this too a while back and this is what I followed:
http://dansen.wordpress.com/2008/04/15/debugging-wcf-clients-and-services/
Visual Studio has feature that
supports attaching to multiple
projects when starting up.
In this example, I have a WCF service
hosted in IIS which lives in the
Wcf.Demo.IisServiceHost project. I
also have a Wcf.Demo.TestHarness
project which calls the service. I
want to be able to attach the debugger
to both the client and service by
simply pressing F5.

Resources