Asp.net web api 当我从Web Api返回InternalServerError时,异常信息在哪里?
我正在从另一个(.NET核心)调用一个Web Api(.NET框架)。如果被调用方返回InternalServerError(异常),如何从调用代码访问该异常 被叫者会这样做:Asp.net web api 当我从Web Api返回InternalServerError时,异常信息在哪里?,asp.net-web-api,Asp.net Web Api,我正在从另一个(.NET核心)调用一个Web Api(.NET框架)。如果被调用方返回InternalServerError(异常),如何从调用代码访问该异常 被叫者会这样做: public IHttpActionResult GetAccountTransactions() { try { // do some stuff } catch (Exception e) { return InternalServerErro
public IHttpActionResult GetAccountTransactions()
{
try
{
// do some stuff
}
catch (Exception e)
{
return InternalServerError(e);
}
}
HttpResponseMessage response = await client.GetAsync(url);
主叫方执行以下操作:
public IHttpActionResult GetAccountTransactions()
{
try
{
// do some stuff
}
catch (Exception e)
{
return InternalServerError(e);
}
}
HttpResponseMessage response = await client.GetAsync(url);
…但是当我将
响应添加到Visual Studio的“监视”窗口时,我找不到异常信息。它不是在响应正文中吗?@dropoutcoder我很可能是瞎的,但我看不到它。或者可能是因为较旧的ASP.NET需要处理异常。。。