(Chan)
1/3/2003 6:06:00 PM
Using VB.net, I just created a webservice (.asmx) page on my LOCAL
machine with the typical "Add" method as:
-------------------
Imports System
Imports System.Web.Services
Imports System.Xml.Serialization
Public Class clsEmail
<WebMethod> Public Function Add(a As Integer, b As Integer) As
Integer
Return a + b
End Function
end class
-------------------
Everything is public.
I use the "WebService Proxy Generator" to generate all files.
I now build a web page .aspx have the following in its page_load
function:
-------------------
dim wsTest as new nsWS.clsWS()
dim b as integer
b = wsTest.Add(1, 2)
-------------------
To test the webservice, I first called up .asmx in my LOCAL browser,
say "http://localhost/testWS.asmx". I got the <Add> button as
expected, click on it got the correct answer.
Now, I call up the .aspx to test if I could use the webservice just
tested, I got error:
Exception Details: System.Net.WebException: The request failed with
HTTP status 401: Access Denied.
The line in .aspx is highlighted
b = wsTest.Add(1, 2)
OS is Win2000, .NET Framework is 1.0 with Hotfix and SP2. Editor is
MS' WebMatrix. IE is 6.0. IIS security is "Allow anonymous" and
"Integrated".
BTW, I did the tutorial sample of WebMatrix using DataGrid, worked
perfectly.
Any clue?
Thanks!