I am making an AJAX call for WebMethod in IIS6 on Win2003Srv, like this, and it works fine:
<System.Web.Services.WebMethod()> _ Public Shared Sub EmailManagers() 'code End Sub
with an AJAX call as follows:
function EmailManagers_Click() { alert('staring email send'); $.ajax({ type: "POST", //url: "EACApprovalOverview.aspx/EmailManagers(" + document.URL + ")", url: "EACApprovalOverview.aspx/EmailManagers", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (msg) { alert("Emails Sent!"); }, fail: function (msg) { alert("Email Send Failed!"); } }); alert('end email send'); return false; };
When I run this application under IIS7.5 on Win2008Srv, I get "Object reference not installed in object instance". Here's the stack trace:
[NullReferenceException: Object reference not set to an instance of an object.] System.Web.Handlers.ScriptModule.OnPostAcquireRequestState(Object sender, EventArgs eventArgs) +162 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
Other errors that I see in the postings contain an extra line at the top of the stack trace, for example:
at System.Web.Script.Services.WebServiceData.GetMethodData(String methodName) at System.Web.Handlers.ScriptModule.OnPostAcquireRequestState(Object sender, EventArgs eventArgs) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Since I am not getting to the call to WebServiceData.GetMethodData, I assume that System.Web.Handlers does not load correctly, causing the ScriptModule to be null.
I have this in my web.config:
<httpModules> <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </httpModules>
and I made sure .net 3.5 sp1 is installed. I even checked the GAC and there is a dll there. What am I missing?