【问题标题】:AutoCompleteExtender not working for WebService hosted on IIS 7AutoCompleteExtender 不适用于 IIS 7 上托管的 WebService
【发布时间】:2010-09-03 12:34:02
【问题描述】:

我的项目中有一个 Web 服务文件,它有一个用于 AutoCompleteExtender 的 Web 方法,当我从 VS 调试它时工作正常。

但是当我在 IIS 上发布和托管它时,它无法正常工作。

但是,我通过输入 URL 直接测试了 webservice 方法,它给出了所需的输出。

是否需要在 IIS 中对其进行特殊设置才能使其正常工作,或者是否需要设置 AutoCompleteExtender 的任何属性?

【问题讨论】:

    标签: asp.net ajax autocompleteextender


    【解决方案1】:

    我在将站点从 cassini 移动到 IIS7.5 时遇到了这个问题。经过大量挖掘后,必须将以下内容添加到 system.webServer 部分的 web.config 中。希望对您有所帮助。

    <modules runAllManagedModulesForAllRequests="true">
          <remove name="ScriptModule" />
          <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        </modules>
    
    <handlers>
      <remove name="ScriptHandlerFactory"/>
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </handlers>
    

    【讨论】:

      【解决方案2】:

      从 ASP.NET 3.5 升级到 4.0 后,我遇到了同样的问题,无法让扩展程序工作。从 firefox 和 firebug 我收到 500 Internal Server Error 消息

      System.InvalidOperationException:请求格式无效:application/json;字符集=utf-8。 在 System.Web.Services.Protocols.HttpServerProtocol.ReadParameters() 在 System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()

      我已使用http://msdn.microsoft.com/en-us/library/bb763183.aspx 建议的 web.config 设置进行测试,但收到配置错误。

      【讨论】:

        【解决方案3】:

        尝试更改处理程序的顺序(删除然后添加)。在此示例中,我删除了除 AJAX/脚本处理程序之外的所有内容。

        <system.webServer>
          <modules runAllManagedModulesForAllRequests="true" />
          <handlers>
            <remove name="WebServiceHandlerFactory-Integrated"/>
            <remove name="WebServiceHandlerFactory-ISAPI-2.0"/>
            <remove name="WebServiceHandlerFactory-ISAPI-2.0-64"/>
            <remove name="WebServiceHandlerFactory-ISAPI-4.0_32bit"/>
            <remove name="WebServiceHandlerFactory-ISAPI-4.0_64bit"/>
            <!--<add name="WebServiceHandlerFactory-Integrated-4.0" ...</handlers> 
        

        【讨论】:

          【解决方案4】:

          不是 IIS 或 ath 的问题。它实际上是一个错误(我认为)。在 webservice 中的函数中返回字符串数组,请检查函数的参数名称或参数。 string参数的名称必须是prefixText,int字段的名称必须是count。

          而且你的webservice中的函数必须有这两个参数。

          喜欢这个

          [WebMethod]
            public string[] getCountry(string prefixText, int count)
              {
                  ......
          ....
          return ...
              }
          

          【讨论】:

            【解决方案5】:

            我也遇到了同样的问题。 AutoCompleteExtender 在 IIS 7 Windows Server 2008 R2 中托管后无法正常工作。

            通过将应用程序池的“托管管道模式”从“集成”更改为“经典”对我有用。 可以通过选择应用程序池 -> 选择基本设置来进行此设置。

            谢谢。

            【讨论】:

              【解决方案6】:

              试试……这个

              开始>运行>inetmgr>

              在连接侧窗格中..选择应用程序池

              选择您在将该项目部署到 iis 时分配的应用程序池(检查转到站点>在连接窗格中...并右键单击您已部署的网站并选择管理网站>高级设置,然后在您将能够看到应用程序池)

              然后返回并在连接窗格的应用程序池中选择该特定应用程序池 右键单击该特定应用程序池并选择高级设置..找出其中的进程模型并选择身份并浏览它并转到内置帐户并选择本地系统....然后单击确定...并获取摆脱它...

              我认为它会起作用..它对我有用......

              【讨论】:

                猜你喜欢
                • 2012-10-29
                • 1970-01-01
                • 1970-01-01
                • 1970-01-01
                • 2014-10-14
                • 2012-03-24
                • 1970-01-01
                • 1970-01-01
                • 1970-01-01
                相关资源
                最近更新 更多