未知的Web方法。参数名:方法名 [英] Unknown web method. Parameter name: methodName

查看:3649
本文介绍了未知的Web方法。参数名:方法名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在这里因此,关于这个主题阅读近10的问题,但没有人能解决我的问题。他们中的大多数,其中关于静态方法。

I've read almost 10 questions here at SO about this topic but none of them were able to solve my problem. Most of them where about the static method.

由于它不工作的实际(和有点复杂)的WebMethod我刚刚创建了一个简单的,为了检查是否到达方法本身是可能的。

Since it's not working with the real (and a bit sophisticated) WebMethod I've just created a simple one for the sake of checking if reaching the method itself is possible.

假设

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

呼叫。

<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>

它总是归结为 500(内部服务器错误)

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 originated in the code. 
Exception Details: System.ArgumentException: Unknown web method HelloWorld.
Parameter name: methodName

有什么建议?

推荐答案

这听起来可能很傻,但为了以防万一......也许这会帮助其他一些悲伤和浪费时间的灵魂的我。

This may sound silly but just in case... Maybe it'll help some other sad and wasting-time soul as me.

我在实际的.aspx文件出了问题,&LT;%@页面语言=C#AutoEventWireup =真正的codeBehind =xxx.xxx.cs继承= xxx.xxx%&GT; 又是如何改变?我不知道。(

I had a problem in the actual .aspx file, the <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="xxx.xxx.cs" Inherits="xxx.xxx" %> How did it get changed? I Don't know :(.

谢谢大家。

这篇关于未知的Web方法。参数名:方法名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆