Google Javascript API 在 windows 服务中加载文档后约 30 秒未发送请求

Google Javascript API not sending request ~30 seconds after document is loaded in a windows service

我有一个奇怪的问题,在本地 html 页面加载完成大约 30 多秒后,调用 google AutocompleteService 或 PlacesService javascript 函数没有发出请求进行查找。但如果少于 30 秒,它就可以正常工作。如果在那段时间内,我什至可以多次成功调用。

背景:

我们有一个 C# dll,供 VB6 应用程序使用,运行s 作为 Windows 服务。该 dll 用于通过 Javascript API 执行自动完成和其他地方 API 查找。 由于 google 查找的异步性质,WebBrowser 控件存在于自己的线程中,具有自己的消息循环,例如

thrd = new Thread(new ThreadStart(
    delegate
    {
       Init(false);
       System.Windows.Forms.Application.Run(this);
    }));
 // set thread to STA state before starting
 thrd.SetApartmentState(ApartmentState.STA);
 thrd.Start();

作为服务启动过程的一部分,这一切都设置一次。

此 dll 在其他地方工作正常,包括在 IIS 和桌面上 运行ning 的应用程序。

疑难解答:

  1. 我确认浏览器线程在来自 windows 服务的后续查找调用中保持活动状态。
  2. 通过调试,我可以看到 javascript 函数(下方)正在 运行(我可以看到调试输出)没有抛出任何错误。但是,google 调用 autocomplete.getPlacePredictions 没有发送任何内容(我们的网络人员在我进行查找时正在监控流量)

javascript 函数示例:

     function doAutoComplete(waitKey, searchString, latBias, longBias,     radiusBias, components, typesFilter) {

        //Removed irrelevant code to keep it brief

        //debug output here

        autocomplete.getPlacePredictions(options, function (waitKey) {
            return (function (predictions, status) {
                window.external.setResult(waitKey, status, JSON.stringify(predictions));
            });
        } (waitKey));

        //debug output here
    }
  1. 安装到 windows 7 机器时该服务没有问题。所以在这个阶段,问题只发生在 Windows 2012 服务器机器上。



关于可能导致 google 调用不起作用的原因,我有 运行 的想法。

任何帮助或想法将不胜感激。

编辑历史:

  1. 已将 #3 添加到疑难解答。

我整理好了。 问题是 IE 增强安全配置 (IE ESC) 在内部 blocking/disabling 调用 Google。关闭它可以防止问题发生,但我会进一步调整它而不是将其关闭。

令人恼火的是它悄无声息地进行着,所以很难被追踪到。我相信这个问题只发生在 运行 作为 windows 服务时,因为它使用的安全级别与来自桌面或 IIS 的 运行 不同。