webservice - 未知的Web方法参数名称methodname

时间:2010-12-28 02:55:32

标签: jquery web-services asmx fullcalendar

我调用了一个web服务来获取fullcalendar中的项目。 永远不会调用该方法,firebug会给出此错误:

* “POST [http]:// localhost:50536 / FullCalendar / ServicioFullCalendar.asmx / GetEventosCalendario POST [http]:// localhost:50536 / FullCalendar / ServicioFullCalendar.asmx / GetEventosCalendario

500内部服务器错误         1.01s” “未知的Web方法参数名称methodname”*

这是asmx.vb代码:

    <System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://localhost/uva/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class ServicioFullCalendar
    Inherits System.Web.Services.WebService

    <ScriptMethod(ResponseFormat:=ResponseFormat.Json)> _
    <WebMethod(MessageName:="ObtieneEventos")> _
    Public Shared Function GetEventosCalendario(ByVal startDate As String, ByVal endDate As String) As String
        Try
            Return CalendarioMensualDAO.Instance.getEventos(startDate, endDate)

        Catch ex As Exception
            Throw New Exception("FullCalendar:GetEventos: " & ex.Message)
        Finally

        End Try
    End Function

web服务从fullcalendar“加载”如下:

events: "ServicioFullCalendar.asmx/GetEventosCalendario",

3 个答案:

答案 0 :(得分:11)

这是错误的:方法必须是“不共享”,没有“消息名称”:

<ScriptMethod(ResponseFormat:=ResponseFormat.Json)> _
<WebMethod()> _
Public Function GetEventosCalendario(ByVal startDate As String, ByVal endDate As String) As String
    Try
        Return CalendarioMensualDAO.Instance.getEventos(startDate, endDate)

    Catch ex As Exception
        Throw New Exception("FullCalendar:getEventos: " & ex.Message)
    Finally

    End Try
End Function

答案 1 :(得分:1)

我建议您使用Fiddler查看网络流量并查看发送给服务的内容。然后弄清楚为什么它会以这种方式发送。

您可能真的以某种方式发送名为“methodname”的参数。

答案 2 :(得分:1)

我遇到了同样的问题,并且花了很多时间才意识到该方法被标记为受保护而不是 PUBLIC 。我把它公开了,它开始工作了。