相关疑难解决方法(0)

未知的网络方法.参数名称:methodName

在研究这个问题时,大多数SO问题都是关于该static方法作为修复.

因为它不使用真正的(有点复杂的)WebMethod我刚刚创建了一个简单的,以便检查是否可以达到方法本身.

[WebMethod]
[ScriptMethod(UseHttpGet = false)]
public static string HelloWorld()
{
    return "Hello World!";
}
Run Code Online (Sandbox Code Playgroud)

电话.

<script>
    $(document).ready(function () {
        $.ajax({
            type: "POST",
            contentType: "application/json; charset=utf-8",
            url: "usersWebMethods.aspx/HelloWorld",
            dataType: "json",
            success: function (data) {
                alert(data.d);
            }
        });
   });
</script>
Run Code Online (Sandbox Code Playgroud)

它总是归结为 500 (Internal Server Error)

Unknown web method HelloWorld.
Parameter name: methodName
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it …
Run Code Online (Sandbox Code Playgroud)

c# asp.net ajax pagemethods

25
推荐指数
2
解决办法
3万
查看次数

标签 统计

ajax ×1

asp.net ×1

c# ×1

pagemethods ×1