jcvandan
jcvandan

Reputation: 14314

Debugging .NET web application during integration testing

I am writing some integration tests for an ASP.NET MVC application, and I am wondering how you can get breakpoints to be hit in the web application after firing a web request at the application.

To give a bit more background, this is what is currently happening:

I know all this is working, as I am getting a 500 back, and my app is logging exactly where in the app an error is being thrown. However, this on it's own is not enough information, I would like the symbols to be loaded for the MVC app so that when I fire the request off I can hit a breakpoint in the web app.

Anyone any idea how to do this?

Upvotes: 0

Views: 1545

Answers (3)

Dallas
Dallas

Reputation: 2227

As long as your app is compiled as Debug, you can attach to the IIS Express process from Visual Studio.

In visual studio, select Attach to process from the Tools menu, and select IIS Express from the list of processes.

After attaching to the process, make a request and it should stop at any breakpoints you have set.

Upvotes: 1

Azhar Khorasany
Azhar Khorasany

Reputation: 2709

There are a few ways to debug it.

  1. In your service code, create a log file and write all exceptions to it. If possible add in all stack trace that will give you some idea where the error might be.
  2. Create a Winform test project within your web service and throw in dummy data to your service code and test the web service (so everything is in one solution).

Upvotes: 0

Myles McDonnell
Myles McDonnell

Reputation: 13335

Does Debugger.Launch() help you here?

Upvotes: 0

Related Questions