title: Moving AJAX call from IIS6 to IIS7.5, fails on System.Web.Handlers.ScriptModule.OnPostAcquireRequestState
body: <p>I am making an AJAX call to a WebMethod under IIS6 on Win2003Srv like this and it works fine:</p>
  
  <pre><code>&lt;System.Web.Services.WebMethod()&gt; _
  Public Shared Sub EmailManagers()
      'code
  End Sub
  </code></pre>
  
  <p>with the AJAX call like this:</p>
  
  <pre><code>    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;
      };
  </code></pre>
  
  <p>When I run this app under IIS7.5 on Win2008Srv, I get "Object reference not set to an instance of an object".  Here's the stack trace:</p>
  
  <pre><code>[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&amp; completedSynchronously) +75
  </code></pre>
  
  <p>Other errors I'm seeing in postings here contain an additional line at the top of the stack trace, like this:</p>
  
  <pre><code>   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&amp; completedSynchronously)
  </code></pre>
  
  <p>Since i'm not getting to the WebServiceData.GetMethodData call, i'm guessing the System.Web.Handlers is not being loaded correctly, resulting in the ScriptModule being null.</p>
  
  <p>I've got this in my web.config:</p>
  
  <pre><code>&lt;httpModules&gt;
    &lt;add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/&gt;
  &lt;/httpModules&gt;
  </code></pre>
  
  <p>and i've ensured that .net 3.5 sp1 is installed.  I even checked the GAC and the dll is there.  What am I overlooking?</p>