简体   繁体   English

ASP.NET AJAX 1.0 Windows Server 2k8

[英]ASP.NET AJAX 1.0 Windows Server 2k8

I am trying to deploy a .NET 2.0 ASP.NET application with AJAX 1.0 on a Windows Server 2008 system running IIS 7. 我正在尝试在运行IIS 7的Windows Server 2008系统上使用AJAX 1.0部署.NET 2.0 ASP.NET应用程序。

The same application that runs perfectly on my development machine, but when published and deployed it won't run AJAX, even though no error messages are displayed. 可以在我的开发计算机上完美运行的同一应用程序,但是在发布和部署时,即使没有显示错误消息,它也不会运行AJAX。 Asynchronous calls will just refresh the entire page (the same symptom described here , but my xhtmlConformance tag is set to Transitional). 异步调用只会刷新整个页面( 此处描述的症状相同,但是我的xhtmlConformance标记设置为Transitional)。 The absence of any errors and messages proves that the AJAX library was found and successfully added to the project. 没有任何错误和消息,证明已找到AJAX库并将其成功添加到项目中。

I've read some posts on this subject, and supposedly there are some tweaks on web.config that should make it work, but after following some of them, I had no success. 我已经阅读了有关此主题的一些帖子,并且据说应该对web.config进行一些调整以使其起作用,但是在遵循其中一些内容之后,我没有成功。

I've added every additional tag available on this sample web.config file to my running web.config. 我已将此示例web.config文件上可用的所有其他标签添加到正在运行的web.config中。

This application was not originally created as an "AJAX-enabled ASP.NET Application", but as a regular ASP.NET application, although it works perfectly while on my development environment. 此应用程序最初不是作为“支持AJAX的ASP.NET应用程序”创建的,而是作为常规ASP.NET应用程序创建的,尽管它在我的开发环境中运行良好。

Question: What should I do to run a .NET Framework 2.0 ASP.NET application with AJAX 1.0 on Windows Server 2k8 with IIS 7 ? 问题:我应该怎么做才能在带有IIS 7的Windows Server 2k8上运行带有AJAX 1.0的.NET Framework 2.0 ASP.NET应用程序?


Before it's suggested: I do want to update it to the newest version of the .NET Framework, and that's being worked on, but I'm not the one making calls regarding subjects like this.. 在提出建议之前:我确实希望将其更新到.NET Framework的最新版本,并且正在开发中,但我不是正在就这样的主题打电话的人。


Update: 更新:

Trying to access /ScriptResource.axd (with the proper querystrings) gives me the following error: 尝试访问/ScriptResource.axd(使用正确的查询字符串)会给我以下错误:

Session state is not available in this context. 会话状态在此上下文中不可用。

It turns out that the issue I added on the update to the question was what caused the whole problem. 事实证明,我在问题的更新中添加的问题是导致整个问题的原因。

Ajax tried to access /ScriptResource.axd, and it ran a method on global.asax that accessed a session variable when in fact there was no session. Ajax尝试访问/ScriptResource.axd,并且在global.asax上运行了一个方法,该方法实际上在没有会话的情况下访问了会话变量。

All I had to do is to check if the session is available before using it on Global.asax, as follows: 我要做的就是在Global.asax上使用会话之前检查会话是否可用,如下所示:

if (HttpContext.Current.Session!=null)
{
   // my code
}

The solution was found on this blog . 解决方案已在此博客上找到。

You've installed ASP.NET AJAX 1.0 on the server, and you have System.Web.Extensions added to your web.config? 您已经在服务器上安装了ASP.NET AJAX 1.0,并且已经将System.Web.Extensions添加到了web.config中? I'm not sure how well it works bin-deployed with your app. 我不确定它在您的应用中bin-deployed的效果如何。 Before we migrated to ASP.NET 3.5, we used to install ASP.NET AJAX 1.0 using the Windows Installer package. 在迁移到ASP.NET 3.5之前,我们曾经使用Windows Installer软件包安装ASP.NET AJAX 1.0。

At a minimum you need: 至少您需要:

<compilation debug="false" defaultLanguage="c#">
  <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

But Microsoft shows a complete file here: ASP.NET AJAX 1.0 Web.config File Contents 但是Microsoft在这里显示了一个完整的文件: ASP.NET AJAX 1.0 Web.config文件内容

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM