Creating ASP.NET Web Service
ASP.NET Web Service – Web service is a software that is used to exchange XML-based information that uses the internet to interact with any other application called its client. This software provides a modular method that could be used by multiple applications through the web.
For detailed information about Web Service visit this thread on WIKIPEDIA
See tutorial below on starting your web service application in ASP.NET.
- I’m using Visual Studio 2013
- Net Framework 3.5
Step 1. First start by opening your visual studio and create new Web Site project.
Step 2. From new web site window choose .Net Framework 3.5 from the drop down just above your middle pane. See image below.
Step 3. Choose ASP.NET Web Service from the middle pane and rename your project
Step 4. The image below is the solution explorer of a newly created website project.
Step 5. Open Service.cs. This file is your main class that contains your web method that is used for your web service method.
- [WebMethod] >> this is used as a declaration for the method that should be accessible on the web.
- This example code returns Hello World string as the output.
This image is the default code generated for a new Web Site project.
Step 6. To run project hit F5 on your keyboard to run project in debugging mode or hit CTRL + f5 to run without debugging mode. Your project will display on a browser containing your method HelloWorld().
Step 7. To test how web service work click on your method and click invoke button.
It should bring you to a new tab containing your return value Hello World. It should look like the image shown below.
You have just created your first ASP.NET Web Service project.
You can start adding your method now and consume it in a client side application.
Thank you for reading. Happy coding!!
Post you may like: