Simple Web Service : Web Service « Network « ASP.Net






Simple Web Service


<%@ WebService Language="C#" CodeBehind="~/App_Code/Service.cs" Class="Service" %>

File: ~/App_Code/Service.cs

using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
    public Service () {

    }

    [WebMethod]
    public string HelloWorld() {
        return "Hello World. The time is " + DateTime.Now.ToLongTimeString();
    }
    
}

 








Related examples in the same category

1.Create a Web Service with C#
2.Create a Web Service with VB