我是使用VS 2005制作的ajax程序,在本地都可以调试成功,但是放到远程服务器上,就不行了。
本地环境是直接下载的ASP.NET 2.0 AJAX Extensions安装包安装的。安装好以后应该是注册到系统中了,而且我在vs里面可以直接使用website enable ajax 选项来新建网站。
可是问题来了,我现在需要部署到远程服务器上,但是我单单拷贝了System.Web.Extensions.dll System.Web.Extensions.Design.dll这两个文件在bin文件夹后ajax没有起效,虽然我曾经在另一台机器上安装了一个ajax的扩展包,可以成功运行,但是收费的远程空间是不会帮我安装整个的,故过来请教朋友指点,很急。拜托帮忙

解决方案 »

  1.   

    这个不需要安装,本地安装主要是给你vs里使用提供些方便。需要在web.config里<system.web>下添加
    <httpHandlers>
    <remove path="*.asmx" verb="*"/>
    <add path="*.asmx" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
    <add path="*_AppService.axd" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
    <add path="ScriptResource.axd" verb="GET,HEAD" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
    <add path="ChartImg.axd" verb="GET,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
    </httpHandlers>
      

  2.   

    webconfig文件里的相关ajax设置已经由vs自动添加好了。您说的这个配置段已经存在了。
      

  3.   

    可能webconfig里别的地方还要配置一下
    比如<pages><controls>下面加个 <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI" tagPrefix="asp"/>
      

  4.   

    也已经有了。我贴出全文
    全文如下
    <?xml version="1.0"?>
    <configuration>
    <configSections>
    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61231.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
    <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61231.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
    <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61231.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
    <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61231.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
    <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61231.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
    <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61231.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
    <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61231.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
    </sectionGroup>
    </sectionGroup>
    </sectionGroup>
    </configSections>
    <system.web>

    <pages>
    <controls>
    <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61231.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    </controls>
    </pages>
    <!--
              Set compilation debug="true" to insert debugging
              symbols into the compiled page. Because this
              affects performance, set this value to true only
              during development.
        -->
    <compilation debug="false">
    <assemblies>
    <add assembly="System.Web.Extensions, Version=1.0.61231.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    <add assembly="System.Drawing.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="System.Web.Extensions.Design, Version=1.0.61231.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></assemblies>
    </compilation>
    <httpHandlers>
                <remove path="*.asmx" verb="*"/>
                <add path="*.asmx" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61231.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
                <add path="*_AppService.axd" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61231.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
                <add path="ScriptResource.axd" verb="GET,HEAD" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61231.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
                <add path="ChartImg.axd" verb="GET,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
            </httpHandlers>
    <httpModules>
    <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61231.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    </httpModules>
    </system.web>
    <system.web.extensions>
    <scripting>
    <webServices>
    <!-- Uncomment this line to customize maxJsonLength and add a custom converter -->
    <!--
          <jsonSerialization maxJsonLength="500">
            <converters>
              <add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>
            </converters>
          </jsonSerialization>
          -->
    <!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->
    <!--
            <authenticationService enabled="true" requireSSL = "true|false"/>
          -->
    <!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved
               and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and
               writeAccessProperties attributes. -->
    <!--
          <profileService enabled="true"
                          readAccessProperties="propertyname1,propertyname2"
                          writeAccessProperties="propertyname1,propertyname2" />
          -->
    </webServices>
    <!--
          <scriptResourceHandler enableCompression="true" enableCaching="true" />
          -->
    </scripting>
    </system.web.extensions>
    <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules>
    <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61231.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    </modules>
    <handlers>
    <remove name="WebServiceHandlerFactory-Integrated"/>
    <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61231.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61231.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61231.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    </handlers>
    </system.webServer>
    </configuration>
      

  5.   

    上面的版本号本来是1.0.61025.0的,后来我改了一下。按照dll上面显示出来的版本号改的,还是不行。难道是publickey不对?反正很怪异的是dll组件我去掉或加进来,好像程序都没影响。按道理没有dll的话应该会报错,那说明根本就没有引用这个dll组件,或者根本这个组件加载后没被用到
      

  6.   

    你这个貌似是ajax1.0安装目录下的web.config内容,它是给你参考的,最好自己在网站根目录的web.config里配置一下。
      

  7.   

    这个内容是vs环境自动给我添加的,我在本机vs环境下可以运行,包括安装了那个安装包的IIS服务器上也能运行,只要拷贝到一个没安装这个安装包的IIS下就挂掉了。即使我拷贝DLL到那个文件夹下了
      

  8.   

    应该是web.config里的问题,不需要安装那个的,参考http://topic.csdn.net/u/20070326/13/d78a9ba7-5ebf-429c-a1ba-6adbf439cbd3.html可能配置文件里添加了多余的东西,我的配置文件里没有那么多东东。你先在本地创建个最简单的ajax网页,配置文件里只添加2楼给你的代码,把dll放在Bin目录下,引用一下,再上传到空间试试。
      

  9.   

    原来是我调试的服务器配置的问题,我是后装的IIS,一着急,竟然忘了设置ASP.NET环境,然后空间那边为了不影响原来的程序,是建立了一个子文件夹做的测试,但是javascript里面引用的路径是使用的错误的webservice路径名,结果一错再错,让我从表向上误认为是bin文件没有生效。还是着急没冷静分析啊,晚上吃晚饭休息了一会就想到了。谢谢楼上的仁兄陪我一直解决问题