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

落爺英雄遲暮 提交于 2019-12-29 05:17:51

问题


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?


回答1:


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.




回答2:


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).




回答3:


Another option is to use our free VS Extension called Conveyor https://marketplace.visualstudio.com/items?itemName=vs-publisher-1448185.ConveyorbyKeyoti With it you open up IIS Express to remote connections on your network (or even the web through tunnelling). Once you've done that you can debug the project directly from VS and connect to the Conveyor port number (or domain name via tunnelling) and debug as you would locally.




回答4:


you can use Postman client.

First : run the API FROM visual studio Second : go to postman put the url and add the parameter in body

More information : http://www.tutorialsteacher.com/webapi/test-web-api



来源:https://stackoverflow.com/questions/16346395/need-to-debug-my-web-api-service-thats-requested-from-a-client-machine-need-h

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!