asp.net Web服务:建立一个web service时,会像web app一样,在iis中建立一个虚拟目录。当service建立好后,引用即以刚建立的web目录(http://localhost......)的方法进行引用。 web service文件是以.asmx结尾的文件,代码文件在.asmx.vb中。同样像类库一样操作,代码写在类中。只是要发布为web service的方法前面加上<WebMethod()> _ 如下: <WebMethod()> _ Public Function HelloWorld() As String Return "Hello World" End Function 当浏览http://localhost/WebService1/Service1.asmx时,将列表显示发布的service。并有更详细的操作解释。 使用方法如下 建立WEB app或window app等。在引用中添加web引用。这时会让选择一个web service的URL 添加对应的WEB URL即可如http://localhost/WebService1/Service1.asmx 在代码中即可以以引用名,类名的方式引用webservice。 如引用名为localhost webservice类为service1 则引用方法为 Dim aa As localhost.Service1 aa = New localhost.Service1