Create WebService in Asp.Net

Create WebService

Step :1 Add New Item 'webService' name MyWebService.asmx

Step :2 [System.Web.Script.Services.ScriptService] //Add to Run Script Service

Step :3 Write your Method below [WebMethod]
ex:
public void getData()
{
//do something here
}
Step :4 Add WebService as a WebReference to your application.

Step :5 Call your Service in your page using localhost


//Publish your web service to other server

Step: 01:Place your webservice file MyWebService.asmx on server.

Step: 02:Add webservice as a WebReference to your application (Call your webservice path)
ex: http://www.xyz.com/MyWebService.asmx.

Step: 02:Place your App_WebReferences on server.

Comments