我试图从调试测试脚本我的.NET Web服务中的异步调用,但我的异步调用内部的断点从来没有击中。我甚至尝试在其中放置一个Debugger.Break()。下面是调用代码...Visual Studio中断点呼叫未击中
HttpClient client = new HttpClient();
client.BaseAddress = new Uri(ConfigurationManager.AppSettings["BaseAddress"]);
string uri = "/api/Rd_Regions";
// Below is the line of code I want to step into, but it won't step into the 'client.GetAsync(uri)'...
HttpResponseMessage response = await client.GetAsync(uri);
if (response.IsSuccessStatusCode)
{
// Convert the result into business object
// Do stuff...
}
else do other stuff...
而且应该得到所谓的在断点是这里的web服务的一部分,首先是被调用的Web API的情况下,后面的方法。我会很高兴,如果在任一...
public partial class PIMSContext : DbContext
{
public PIMSContext()
: base(new OracleConnection(Security.ConfigurationReader.GetAppSetting("PIMS")), true)
//: base(new OracleConnection(ConfigurationManager.ConnectionStrings["PIMS"].ConnectionString), true)
etc....
停止,这里是最终调用的方法:
// GET: api/RD_REGIONS
public IQueryable<RD_REGIONS> GetRD_REGIONS()
{
// I want the debugger to stop here!
Debugger.Break();
return db.RD_REGIONS;
}
我缺少的东西?是不可能进入这个异步调用? 任何洞察力表示赞赏。
你在使用测试方法进行调试吗?或者通过网页浏览器? – aMazing
是的,我正在通过Visual Studio Online 2015中的测试方法调试该服务。我在调试模式下建立并停止在异步调用之前的行,并且当我尝试F11(步入)异步调用时,它只是进入下一行。 – ingep