title: asmx web service method name is not valid
body: <p>Could really use some help here...</p>
  
  <p>I am trying to use an object as a parameter in one of my web methods, but I get the following error message:</p>
  
  <pre><code>System.InvalidOperationException: TestParameter Web Service method name is not valid.
     at System.Web.Services.Protocols.HttpServerProtocol.Initialize()
     at System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext context, HttpRequest request, HttpResponse response)
     at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean&amp; abortProcessing)
  </code></pre>
  
  <p>ASMX Code:</p>
  
  <pre><code>Imports System.Web.Services
  Imports System.Web.Services.Protocols
  Imports System.ComponentModel
  Imports System.Web.Script.Serialization
  
  ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
  &lt;System.Web.Script.Services.ScriptService()&gt;
  &lt;System.Web.Services.WebService(Namespace:="http://tempuri.org/")&gt; _
  &lt;System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)&gt; _
  &lt;ToolboxItem(False)&gt; _
  Public Class TestService
      Inherits System.Web.Services.WebService
  
      &lt;WebMethod()&gt;
      Public Function TestParameter(ByVal req As TestObject) As String
          Return New JavaScriptSerializer().Serialize(req)
      End Function
  
      &lt;WebMethod&gt;
      Public Function TestGetParameter() As String
          Return New JavaScriptSerializer().Serialize(New TestObject)
      End Function
  
      Public Class TestObject
          Public var1 As String = String.Empty
          Public var2 As Integer = 1
      End Class
  
  End Class
  </code></pre>
  
  <p>I have already spend hours looking on Google and could not find anything that worked so far :(</p>
  
  <p>I have already added the following in my web.config</p>
  
  <pre><code>  &lt;webServices&gt;
      &lt;protocols&gt;
        &lt;add name="HttpGet"/&gt;
        &lt;add name="HttpPost"/&gt;
      &lt;/protocols&gt;
    &lt;/webServices&gt;
  </code></pre>
  
  <p>And my "test" ajax call:</p>
  
  <pre><code>   $(function () {
          debugger;
          request = { "var1": "", "var2": 1 };
  
          var settings = {
              async: true,
              crossDomain: true,
              contentType: "application/json; charset=utf-8",
              dataType: "jsonp",
              url: "http://server/TestService.asmx/TestParameter",
              method: "POST",
              data: "{ 'req':" + JSON.stringify(request) + "}"
          }
  
          $.ajax(settings).done(function (response) {
              console.log(response);
          });
      });
  </code></pre>
  
  <p>As you can see, it can hardly be simpler, yet it does not work! What am I doing wrong??</p>
  
  <p>Running on IIS7.5 with windows authentication (no anonymous) and ASP.NET v3.5; Pipeline mode = Classic</p>