Ajax Post 和 Chrome 中奇怪的 http 响应。我无法在本地重现该问题

Ajax Post and weird http response in Chrome. I can't reproduce the issue locally

我正在使用 KendoUI AutoComplete 组件,该组件会在用户开始输入数字时立即拉回数据。我们有一个学区有问题。

在 Chrome 中,他们看到等待 "spinney" 与服务器的响应明显断开连接,可能是未处理的异常。状态为 ERR_EMPTY_REPONSE。似乎当用户停止输入时,当前请求可能会以某种方式中止。但是我有一个正在触发的 onSuccess 函数。来自那个 ajax 电话。这是代码部分:

//TEMP METHODS TO REDUCE CLUTTER. These should be moved out and encapsulated
renderEntitySearch: function (
    targetElement,//Parent Div
    searchUrl,//The url to perform the search and get results
    detailsUrl,//The url to get details view when a search item is selected
    rootUrl,//For images
    searchText,//Grey text in empty search box
    homeUrl//This is used to push the back view onto the view controller when a selection is made
    )
{

    var that=this;
    var textBox = $("#" + targetElement);
    textBox.focus(function () { this.value = ""; });

    textBox.width(325);
    textBox.addClass('il-searchBox');
    textBox.kendoAutoComplete({
        dataTextField: "EntityName",
        placeholder: searchText,
        //template: "<mark>${data.EntityTypeName}</mark> ${data.EntityName}",
        template: "<img src='" + rootUrl + "Images/Icons/16/${data.EntityTypeName}.png'/> <mark>${data.EntityName}</mark>",
        width: "225px",
        highlightFirst: true,
        dataSource: {
            dataType: "json",
            type: "GET",

            transport: {
                read: {
                    type: "json",
                    url: searchUrl,
                    data: function () {
                        return { searchTerm: $("#" + targetElement).val() };
                    }
                }
            },
            serverFiltering: true
        },
        select: function(e)
        {
            var dataItem = this.dataItem(e.item.index());
            if (dataItem.EntityID.length > 0) {
                that.loadView(
                    {
                        viewName: "mainView",                            
                        alwaysRefresh: true,
                        resetHistory: true,
                        homeViewOptions: 
                        {
                            viewName: "mainView",                                   
                            alwaysRefresh: true,
                            resetHistory: true,
                            url: homeUrl                                                            
                        },
                        url: detailsUrl,
                        data: { EntityType: dataItem.EntityType, EntityID: dataItem.EntityID }
                    });
            }
        }
            //searchCallBack
    });
},

以及执行搜索的服务器代码。

//------------------------------------------------------------------------------------------------------
[OutputCache(NoStore = true, Duration = 0)]
public JsonResult Search(string searchTerm)
{
    //This method returns data to the ajax initiated search request. This is the function that fires when the user types in text in the search bar to return 
    //search results.

    if ((searchTerm) == null) return null;
    //Call the search services and return the data as json

    SearchRequest _request = new SearchRequest();
    _request.User = MyWebApp.Session.CurrentUser;
    _request.SearchFlags = UserTypeEnum.All;
    _request.SearchTerm = searchTerm.ToLower();

    return Json(new My.Controllers.Data.SearchController().PerformQuickSearch(_request), JsonRequestBehavior.AllowGet);
}      

老师对我们的工作很有帮助。我们收到了无法重现的错误的 F12 屏幕截图。

Chrome 发生错误时的响应。

正常,我所见。 (chrome)

  1. 获取 GET 的(待定)文本

  1. 等待整个响应被读取,然后将状态更改为确定。这是她的浏览器不喜欢的部分。

我在 IE、Fiddler 中的工作输出 returns 搜索结果相似。

我认为她可能被锁定在旧版本的 Chrome 中,该版本在处理读取 header 但完整响应不包含数据的情况时存在问题,And/or 有防火墙或其他 add-on 运行 认为这是异常的。

任何人都遇到过这个问题或对我如何解决这个问题有见解?

更新:感谢评论

我刚从现场收到最新消息。我寄给 Telerik 的票似乎得到了回报。数据源的属性不正确。数据源应定义如下:

dataSource: {
     transport: {
          read: {
              dataType: "json",
              type: "GET",
              url: searchUrl,
              data: function () {
                  return { searchTerm: $("#" + targetElement).val() };
              }
          }
      },

但是,这并不能解释这是如何通过我们的质量检查的,即使配置关闭,一个客户也遇到了问题。

这通常是当您有外部程序(例如病毒)试图拦截数据时引起的。出于安全目的,chrome 取消请求。我建议您进行一次完整的病毒扫描,并检查您的程序和功能是否有最近添加的任何新程序。有时 chrome 扩展也可以这样做。也许最近更新的一个或您添加的一个新的导致了问题。