【发布时间】:2013-05-16 03:08:52
【问题描述】:
我们知道,如果我们使用Visual Studio构建Web服务,Visual Studio会自动生成两个文件,第一个是.asmx,第二个是.vb作为后面的代码。
在代码后面(.vb)中我得到的是这样的:
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class WebService
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function HelloWorld() As String
Return "Hello World"
End Function
End Class
在 .asmx 文件中,我得到的是这样的:
<%@ WebService Language="VB" CodeBehind="~/App_Code/WebService.vb" Class="WebService" %>
问题是
- .asmx 文件的主要用途是什么?只显示一行代码,有用吗?
- 我们可以制作一些方法是 .asmx 文件而不是 code_behind 吗?以及如何从 .aspx 文件中使用它?
【问题讨论】:
-
@Selvam 我只是按照这些说明进行操作,但是如何从 .aspx 调用 .asmx 文件中的方法?
标签: asp.net web-services asmx