title: Why does an asmx file have to have a webservice with just an int as a parameter?
body: <p>I have an asmx web service which requires a string and two ints to return data.  When I run the asmx page directly and invoke it, I get a 500 error and on chrome get the following:</p>
  
  <pre><code>System.IndexOutOfRangeException: Index was outside the bounds of the array.
  at System.Web.Services.Protocols.HttpServerType..ctor(Type type)
  at System.Web.Services.Protocols.HttpServerProtocol.Initialize()
  at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean&amp; abortProcessing)
  </code></pre>
  
  <p>But, when I add the following web service to the asmx.cs file along side my actual web service, it works.</p>
  
  <pre><code>[WebMethod]
  [ScriptMethod(UseHttpGet = true)]
  public string getBlah(int blah)
  {
      return "blah";
  }
  </code></pre>
  
  <p>I then went to a few older sites I've worked on, all of which had at least one web service that just had an int for input, and when I removed the int only web service, the rest failed.  So why does asmx web services require a web service with only an int as a parameter for the other web services to work?</p>
  
  <p>This is happening on .Net 4.  Haven't tested any other versions.</p>
  
  <p>EDIT:</p>
  
  <p>I was able to create a mockup that is broken, but even adding the int doesn't seem to fix this one.  I created a new web forms .net 4 project and added the following asmx file to it.  Commenting out AMethod causes Owners to break instead of returning nothing.  I'm using values a, 1, 1 for the three fields of the Owner webservice.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Data;
  using System.Linq;
  using System.Web;
  using System.Web.Script.Serialization;
  using System.Web.Script.Services;
  using System.Web.Services;
  
  
  namespace WebApplication2
  {
      /// &lt;summary&gt;
      /// Summary description for WebService1
      /// &lt;/summary&gt;
      [WebService(Namespace = "http://www.mysite.com/")]
      [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
      [System.ComponentModel.ToolboxItem(false)]
      [System.Web.Script.Services.ScriptService]
      public class WebService1 : System.Web.Services.WebService
      {
  
          [WebMethod]
          [ScriptMethod(UseHttpGet = true)]
          public string AMethod(int page)
          {
              return "blah";
          }
  
          [WebMethod]
          [ScriptMethod(UseHttpGet = true)]
          public void Owners(string searchTerm, int pageSize, int page)
          {
              string retJson = "";
  
              Context.Response.Write(retJson);
          }
  
          [WebMethod]
          [ScriptMethod(UseHttpGet = true)]
          public string Results(List&lt;string&gt; counties, List&lt;string&gt; field2, List&lt;string&gt; field3, string owners, int pageSize, int page)
          {
              return "[\"test\":\"hi\",\"test2\":\"bye\"]";
          }
      }
  }
  </code></pre>