On production machine: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts.

I was helping my colleagues to debug one weird bug on ASP.NET 4.0 website. Everything worked well on developer’s machine, but after publishing to IIS 7.5 Windows 2008 R2 Webserver, we always got site partially working. Everything worked, except AJAX Control Toolkit controls.

There were no any signs of errors. Ajax controls just were not functioning. Digging deeper, we found, that JavaScript is throwing exceptions:
SCRIPT5022: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. Ensure the correct version of the scripts are referenced. If you are using an ASP.NET ScriptManager, switch to the ToolkitScriptManager in AjaxControlToolkit.dll.

This is the most common error with AJAX Control Toolkit — you need to use ToolkitScriptManager instead of ScriptManager. Read more here.

But in our case we was already using ToolkitScriptManager in the all places in our source code.

Digging deeper we found that there is a bug in Script Manager, that is trying to load all DLLs in the project’s bin folder. Script Manager is trying to load DLL files even if they are not used in the project. [I know, that it is not best practice, to keep files not used by project on the production server, but that’s another story.]

The solution was plain and simple: remove all unused DLLs from production machine’s bin folder.

More info about bug and the same problem in different product:

5 replies on “On production machine: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts.”

  1. Thanks! This issue had been driving me crazy for the better part of a day. Everything worked fine when deployed to my local IIS, but not when deployed to our server. Was about to give up on the Ajax Toolkit when I found your post. In my case, the Microsoft.ScriptManager.*.dll files were the culprits.

  2. Ken, removing the Microsoft scriptmanager dlls and removing the following bundles made the trick.

    Thank you very much. You are awesome.

  3. HI, Ajax.Utility.GenerateMethodScript is not working when I switched the application from IIS6 to IIS8.
    Method is not getting called from Javascript to C# class.

Comments are closed.