现在的位置: 首页 > 综合 > 正文

JS调用Webservice

2013年10月12日 ⁄ 综合 ⁄ 共 792字 ⁄ 字号 评论关闭

如有不明白的地方欢迎加QQ群14670545探讨

原文:http://www.cnblogs.com/Ren_Lei/archive/2010/07/14/1777343.html

1.新建一个WebApplication项目,取默认设置。

2.添加一个WebService,代码如下:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System.ComponentModel;
using System.Web.Services;
 
namespace WebApplication1
{
    ///
<summary>
    ///
WebService1 的摘要说明
    ///
</summary>
    [WebService(Namespace
=
"http://tempuri.org/")]
    [WebServiceBinding(ConformsTo
= WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    //
若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。
    [System.Web.Script.Services.ScriptService]
    public class WebService1
: System.Web.Services.WebService
    {
 
        [WebMethod]
        public string HelloWorldFun1()
        {
            return "Hello
World"
;
        }
        [WebMethod]
        public string HelloWorldFun2(string str)

抱歉!评论已关闭.