Posts

Showing posts from June, 2015

How to Create a very Basic Web Service in C# (Visual Studio)

Image
In this blog I am going to show how we could create a very basic Web Service in c#.

1. First of all Open your Visual Studio and GoTo File and Select New Empty Website and rename and open your new empty website.



2. For adding the web service right-click on the solution and then Select Add- Add New Item- Select Web Service(asmx) file, you will get it's class file open as in figure, remove "Hello World" web default method and add code as below::

using System; using System.Web.Services;
[WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] // 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 Service : System.Web.Services.WebService {     public Service()     {
        //Uncomment the following line if using designed components          //InitializeComponent();      }
    string[,] stocks = {{"I…
go to top image