0

绝对是我的智慧到此为止。这应该很简单。在创建新用户帐户的页面中,我们有一个包含少量允许用户的数据库。为了简化正确获取新用户的电子邮件地址,我们希望使用自动完成扩展文本框。

现在我知道 WebMethods 正在工作,因为我有一个与另一个页面中的 Web 方法相关联的级联下拉菜单。

因为我刚开始在这个页面上,代码很简单。

页面本身:

<cc1:ToolkitScriptManager ID="ScriptManager2" runat="server"/>
<p></p> Please enter new user's Email: 
<asp:TextBox ID="txtUser" runat="server" />
<cc1:AutoCompleteExtender runat="server" ID="autUser" TargetControlID="txtUser" 
        ServiceMethod="ScanGALUsers" ServicePath="~/AutoScan.asmx"
        MinimumPrefixLength="3" CompletionSetCount="150" /> <p></p>

.asmx 文件很简单:

<%@ WebService Language="VB" CodeBehind="~/App_Code/VB_Code/AutoScan.vb" Class="AutoScan" %>

网络方法:

<System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class AutoScan
    Inherits System.Web.Services.WebService

   <WebMethod()> _
    Public Shared Function ScanGALUsers(ByVal strPrefix As String, ByVal intMaxCount As Integer) As String()
        Dim arlResults As New ArrayList
        Dim intCount As Integer
        Dim dt As DataTable
        Dim colParameters As New SortedList
        SysDA.LogDebug("ScanGALUsers called with parameters: " & strPrefix & " and count of " & intMaxCount.ToString)
        ... Deleted for brevity ...
        If intCount > 0 Then
            Dim arrResults(intCount - 1) As String
            arrResults = arlResults.ToArray(GetType(System.String))
            Return arrResults
        Else
            Return Nothing
        End If
    End Function

End Class

我什至没有进入 LogDebug 语句。我已经使用了在另一个 WebMethod 中工作的所有相同的样板代码(继承、“WebService”标签等),并对类名称进行了适当的更改,但这真的让我很难过。

我错过了什么,我什至没有做到这一点?

4

1 回答 1

0

你有没有解决过这个问题?您是否尝试过从Shared您的 WebService 声明中删除?这以前对我有用(我不知道为什么!)。

于 2011-10-25T13:33:30.563 回答