相关疑难解决方法(0)

调用共享WebMethod时出现未知Web方法异常

我正在尝试在我的网站上实现视图跟踪Web服务.我正在使用JavaScript,因为我想从我的跟踪视图中排除任何搜索机器人.问题是当我尝试使用jQuery发布到我创建的Web服务时,我收到了"未知的Web方法"错误.

$(document).ready(function() {

  $.ajax({
    type: "POST",
    url: '<%=ResolveUrl("~/WS/ItemViewTrackingService.asmx/TrackItemView") %>',
    data: "{'itemType': 'thread', 'itemId':<%=mThread.ThreadID %>}",
    contentType: "application/json; charset=utf-8"
  });

});
Run Code Online (Sandbox Code Playgroud)

这是Web服务.

Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel

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

  <WebMethod(EnableSession:=True)> _
  Public Shared Sub TrackItemView(ByVal itemType As String, ByVal itemId As Int32)

    If itemType.Equals("column", StringComparison.OrdinalIgnoreCase) Then
      Services.ViewTrackingService.TrackColumnView(itemId)
    ElseIf itemType.Equals("thread", StringComparison.OrdinalIgnoreCase) Then
      Services.ViewTrackingService.TrackThreadView(itemId)
    End If

  End Sub

End Class
Run Code Online (Sandbox Code Playgroud)

该错误是ASP .NET错误:未知的Web方法TrackItemView.参数名称:methodName

我已经完成了数百次(看似),但我看不出我错过了什么.我确定这是小事......

asp.net jquery web-services asmx

4
推荐指数
1
解决办法
2771
查看次数

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

我调用了一个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
Run Code Online (Sandbox Code Playgroud)

web服务从fullcalendar"加载",如下所示:

events: "ServicioFullCalendar.asmx/GetEventosCalendario",
Run Code Online (Sandbox Code Playgroud)

jquery web-services asmx fullcalendar

4
推荐指数
1
解决办法
9383
查看次数

标签 统计

asmx ×2

jquery ×2

web-services ×2

asp.net ×1

fullcalendar ×1