Bra*_*ery 4 asp.net jquery web-services asmx
我正在尝试在我的网站上实现视图跟踪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
我已经完成了数百次(看似),但我看不出我错过了什么.我确定这是小事......
| 归档时间: |
|
| 查看次数: |
2771 次 |
| 最近记录: |