WebAPI Response never terminates when returning HttpResponseMessage and Application Insights

I have an MVC5 / WebAPI2 application that has had an Insights application since the creation of the web project.

WebApi methods that return objects (for example, a string, model objects) are returned as expected - serialized in JSON or XML.

 public class TestController : ApiController
{
    [HttpGet]
    [AllowAnonymous]
    async public Task<HttpResponseMessage> ReadString(int id) {

        HttpResponseMessage response = Request.CreateResponse();

        string str;
        using (HttpClient client = new HttpClient()) {
            Uri uri = new Uri("http://someurl.com/resource.rss");
            str = await client.GetStringAsync(uri);
        }

        response.Content = new StringContent(str);
        response.Content.Headers.ContentLength = str.Length;

        return response;
    }
}

When I created an action that returns an HttpResponseMessage, I noticed strange behavior in the browser (tested with Chrome and IE). In particular, my content was returned to the browser, but the busy indicator never stopped until I clicked the Stop button or stopped the web server (Visual Studio 2013).

, , , - Application Insights. , , . Application Insights, .

?

+4
1

NullReferenceException, ASP.NET. Microsoft.ApplictionInsights.Web HttpApplication.PreSendRequestHeaders, . 0.17 Application Insights, , .

0

All Articles