IIS & Chrome: failed to load resource: net::ERR_INCOMPLETE_CHUNKED_ENCODING

后端 未结 6 1721
感情败类
感情败类 2020-12-06 00:27

I recently came across a Chrome issue which I think is worth sharing it with you.

I worked on a self written API using an HttpHandler which primary should return jso

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-06 00:35

    Once I had the same problem and the main reason was lying in my controller return type. If you try to return a C# object just as-is, you will only get net::ERR_INCOMPLETE_CHUNKED_ENCODING so don't forget to serialize your complex objects before sending them out for java script client (or View). i.e. my controller return type was :

    public async Task> GetComplexModelList(){
        return new List()
    }
    

    Which caused INCOMPLETE_CHUNKED_ENCODING error, so I tried to fix my mistake with something like:

    using Newtonsoft.Json;
    ...
    public async Task GetComplexModelList(){
        return JsonConvert.SerializeObject(new List())
    }
    

提交回复
热议问题