Creating a Web Service using C #

Source: Internet
Author: User

A Web Services Overview:

Web services are a new branch of Web applications that are self-contained, self-describing, modular, and can be published, positioned, and invoked via the Web. Web services can perform any function from simple requests to complex business processes. Once deployed, other Web service applications can discover and invoke the services that it deploys. Web services can divide business logic into one component and perform its functions across the Internet. Therefore, it is the latest technology development trend to construct distributed and modular applications.

Two Why do I need a Web service?

Previously, distributed application logic required the use of distributed object models, and by using basic structures such as DCOM, CORBA, and RMI, developers could still have the rich resources and accuracy to use the local model, and could place services on remote systems.

Why do we have to worry about the web when there are already desirable middleware platforms (RMI, Jini, CORBA, DCOM, and so on)? Middleware does provide a powerful service implementation, but there is a common flaw in these systems, which is that they cannot be extended to the Internet: they require a tight coupling between the service client and the system-supplied service itself, requiring a homogeneous infrastructure. However, such systems are often very fragile: if one end of the execution mechanism changes, then the other end will collapse. For example, if the interface of the server application changes, the client crashes. In order to expand to the Internet, we need a loosely coupled infrastructure to solve this problem. In this case, the birth of the Web service is ushered in.

Three Development environment:

1. Windows server operating system or Windows XP operating system;

2..Net framework and Visual Studio.NET development tools.

Four To create a Web service project:

I am here to introduce you to a dollar to renminbi conversion of the Web Services instance, the completion of the function is quite simple, from the name we can know the function. But this is also a very good example, especially for beginners, can play a very good guiding role. In the process of creating a Web service, we used the C # language. The following is the specific project steps.

First, open vs.net, create a new item, select "Visual C # project" In the left panel, select "ASP.net Web Service" in the right panel, and name "WebService1" as shown below:

Figure 1

When you press the OK button, Vs.net begins to help you create the project, and a dialog box may appear to display the Internet connection. After you have created the project, the following interface appears in the development tool:

Figure 2

Because we're going to implement a very simple Web service, so we need the functionality and our code is very small, so we do not have to consider the figure in the "Server Explorer" and "toolbox" two hyperlinks, but you can directly click on the "Here" link in the map to edit the code, Click to open the Code edit box, as shown below:

Figure 3

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.