I have a Web API application created on Visual Web Developer 2010 Express.
Then I have this code:
public class ProductController : ApiController
{
// POST api/product
public void Post([FromBody]string value, HttpRequestMessage request)
{
int i = 5;
}
...
I use "Use Local IIS Web Server" to debug the application on IIS 7.5/Windows 7. The application runs in a pool with "Maximum Worker Processes"=1, in integrated mode.
I have a breakpoint in "int i = 5;"
I press F5, then I post to the webservice using a form on URL http://localhost/. The post URL is /mcp.test/api/product . Most of the times the breakpoint is hit as expected. Occasionaly, specially after I leave the application paused in the breakpoint for a long time, and then continue (F5), the break point is not hit when I post the form. I still get the same response (status code 204) as when the breakpoint is hit, but without a hit.
IIS log:
2015-02-03 22:12:01 ::1 POST /mcp.test/api/product - 80 - ::1 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/40.0.2214.93+Safari/537.36 204 0 0 999
2015-02-03 22:12:03 ::1 POST /mcp.test/api/product - 80 - ::1 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/40.0.2214.93+Safari/537.36 204 0 0 3
The first line is a breakpoint hit (999 is the time it took), the second line is a breakpoint miss (it takes only 3 in time).
The task manager shows only one w3wp.exe worker process running.
How can I hit the breakpoint 100% of times?