关于Web Service的问题
在Visual Studio2005中创建.asmx文件,当公有类的名称与公开服务的函数方法名称一样时,在ASP.NET中就不能正确地使用这个Web Service。请指教这是什么原因?这是出现问题的代码:
.asmx文件:
<%@ WebService Language="VB" Class="X803" %>
Imports System
Imports System.Web.Services
Public Class X803 : Inherits WebService
<WebMethod()> Public Function X803(ByVal str As string, ByVal Op As single) As String
Return Microsoft.VisualBasic.Left(str, Op)
End Function
End Class
.aspx文件:
<%@ Import Namespace="ServiceX803" %>
<script language="VB" runat="server">
Dim Str As String
Dim Op As Single = 1
Public Sub Submit_Click(Sender As Object, E As EventArgs)
Try
Str = Operand1.Text
Op = Single.Parse(Operand2.Text)
Catch Exp As Exception
' Ignored
End Try
Dim Service As ServiceX803.X803 = New ServiceX803.X803()
'提示X803不是ServiceX803.X803 的成员
Result.Text = "<b>结果</b> = " & Service.X803(Str, Op)
End Sub
</script>
--------------------编程问答-------------------- VB?
闪人..
补充:.NET技术 , ASP.NET