为asp.net,HTML创建/使用Web服务

时间:2011-03-02 18:55:05

标签: asp.net web-services

我需要构建某种可以轻松调用3dr派对API的服务。

可以通过简单的方式完成呼叫 1)HTML页面 2)ASPX页面 3)移动设备

我需要帮助才能找到最好的方法。

我应该单独创建一个单独的Web服务项目并创建几个方法[WebMethod]

这个方法也可以是静态的吗?

 /// <summary>
    /// Summary description for signup_service
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class signup_service : System.Web.Services.WebService
    {

        [WebMethod]
        public string CheckZone()
        {
            return "Hello World";
        }
    }

1 个答案:

答案 0 :(得分:1)

web方法不能是静态的。 原因如下:http://weblogs.asp.net/jasonsalas/archive/2004/02/03/66595.aspx

如果您需要通过AJAX请求与服务进行交互,则需要使用[ScriptService]和/或使用[ScriptMethod]

的webmethods来装饰Web服务

Web服务不需要在他们自己的项目中,但该架构决策基于您正在进行的任何其他事情。

相关问题