|
This course
- Write a web service in C# on your local machine (Tutorial 1) v1.0 - last updated: 08/07/2006 |
In this tutorial, you create an XML web service on your
local disk using Visual Studio 2005's local web server.
There are 8 steps...

In the New Web Site window, select ASP.NET Web Service. Select location as File System, and browse to a folder where you'd like to put the code (this can be a new folder). Select Visual C# as the language, and click OK. This will create the default code for an XML web service in the folder you chose.
<%@ WebService Language="C#" CodeBehind="~/App_Code/Service.cs" Class="Service" %>Change the class from Service to Hello, as follows:
<%@ WebService Language="C#" CodeBehind="~/App_Code/Service.cs" Class="Hello" %>




NOTE: While located on your local disk drive, this service requires Internet Explorer. If IE is not your default browser, you will first have to select Browse With...IE and make it the default for testing in Visual Studio. After that, you'll be able to select View in Browser and you'll get IE each time. This will not alter the default browser on your machine as a whole, only for Visual Studio.
The browser should show the HTML version of the WSDL page:

Click on the Invoke button to call the method. After a short pause,
you should see the resulting XML file that was returned:

This means your web service is working correctly while located on your local
disk drive.
This is the end of Tutorial 1. See other tutorials.