Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need to debug my Web API service that's requested from a client machine - need help, how do I do this?

I built a Web API service that's hosted locally on my machine in IIS. I have an iOS app that I'm running via XCode that makes the call to the web service. The connectivity is there, and works. The iOS app successfully makes the connection to my published web service.

The problem is my web service is returning a non descriptive error to the client (iOS), so what I need to be able to do is step through the web service code while running my iOS app.

So, in summary:

  1. I run an iOS app via my MacBook, and it connects to my .NET Web API service.
  2. My Web API service is published to my local IIS, and is returning an error back to the client.
  3. Breakpoints aren't being hit in Visual Studio - do I need to attach my Visual Studio debugger to a specific process? I've tried running my web service in debug mode while running my iOS app, to no avail.

How can I step through my web service code when running the client app (iOS) that accesses the web service?

like image 827
Mike Marks Avatar asked May 02 '13 19:05

Mike Marks


People also ask

How would you debug If there is an issue with API output?

To fix the API call for those two situations, make sure that the credentials you are using have the access-level required by the endpoint, or that the access token has the correct permissions. A less common reason we might see this error is if we're not explicit about the Accept header value.


2 Answers

Attach to process - http://msdn.microsoft.com/en-us/library/vstudio/3s68z0b3.aspx

Make sure "Show processes from all users" is checked, and pick w3wp.exe

You may need to hit the service once first to make sure its started.

like image 88
EkoostikMartin Avatar answered Sep 25 '22 01:09

EkoostikMartin


To debug an app that's hosted by IIS, you want to attach to process (in Visual Studio it's Tools->Attach to Process or Ctrl+Alt+P) and pick w3wp.exe from the list (you might have to check a few boxes for the process to show up).

like image 41
Stephen Fischer Avatar answered Sep 27 '22 01:09

Stephen Fischer