Summary:
Components that call web services or page methods stop working after migrating to ASP.NET AJAX Beta 1. You may see errors such as [Method Error 12031] or [Method Error 500].
Fix:
Web Services that you plan to call from client code must be decorated with the Microsoft.Web.Script.Services.ScriptServiceAttribute.
[Microsoft.Web.Script.Services.ScriptService()]
public class MyService : System.Web.Services.WebService {
// ...
}
There has also been a change to the usage of PageMethods for ASP.NET AJAX Beta 1. PageMethods must now be static (Shared in VB) in order for them to be accessible from script, and must be decorated with the Microsoft.Web.Script.Services.ScriptMethodAttribute. Moreover, due to a known issue in ASP.NET AJAX Beta 1, they must be delcared in the ASPX file, and will not work if declared in the code behind file:
<script runat="server">
[System.Web.Services.WebMethod] [Microsoft.Web.Script.Services.ScriptMethod] public static string GetHtml(string contextKey) { // ...
}
</script>
Don't forget, this posting is provided "AS IS" with no warranties, and confers no rights.