Unknown web method. Parameter name: methodName

I had this issue as well, but slightly differently I had this method in a .asmx file and so ran across the "static" issue, but in a different way.

If you have a method as part of your Page class, it must be static.

If you've put a method in an .asmx file to use across several pages, it must not be static.


Missing the [WebMethod] above your server side function will also cause this error.


For me, the primary issues was to change javascript post to pass in no arguments such as

$http.post("Status.aspx/MyData", {})

Then to verify nothing was cached, I then deleted [System.Web.Services.WebMethod] in the code behind file above public static string MyData(). Then I built the project to failure, then re-added the aformentioned deleted attribute and built to success.

Upon running it worked.


I had a problem in the actual .aspx file, the line

<%@ Page Language="C#" 
         AutoEventWireup="true" 
         CodeBehind="xxx.xxx.cs" Inherits="xxx.xxx" %>

wasn't present in the code. How did it get changed? I Don't know :(.