Simple coding, publishing, and deployment of Web Service (C # instance), webservice
Recently, the boss is preparing to make the communication part of the existing C/S architecture project universal. He needs to support WebService to pave the way for the future B/S architecture upgrade, for this reason, I went to a variety of Baidu WebService tools, and gradually set up a simple WebService. By the way, I learned how to use it later! Here!
Simple coding, publishing, and deployment of Web Services
Preface:
Web service is a platform-independent, low-coupling, self-contained, programmable web-based application that can use open XML (a subset of standard General Markup Language) standards are used to describe, publish, discover, coordinate, and configure these applications for Distributed interoperability applications.
Web Service technology enables different applications running on different machines to exchange data or integrate with each other without additional, dedicated third-party software or hardware. Applications implemented according to Web Service specifications can exchange data with each other regardless of the language, platform, or internal protocol they use. A Web Service is a self-describing and self-contained available network module that can perform specific business functions. Web services are also easy to deploy, because they are based on some common industrial standards and some existing technologies, such as the subset XML and HTTP in the standard General Markup Language. Web Service reduces the cost of application interfaces. Web Service provides a general mechanism for the integration of business processes across an enterprise or even multiple organizations.
Create a WebService instance:
Development Tool: flagship version of vs2013
Development Environment:. Net FrameWork 4.0
WebService Project
WebService Creation
Publishing WebService
Deploy WebService on IIS
After IIS deployment is completed, access through the browser
Package and download of project files (including the released version)
1. Create a WebService
1. Create a project
2. Select web-> asp.net web form application
3. Add a web Service
4. Select web Service-you can name it as needed. Here is WebService1.
5. the default method is HelloWorld ()
1 [WebMethod]
2 public string HelloWorld ()
3 {
4 return "Hello World ";
5}
Add another method for testing.
1 [WebMethod]
2 public string GetStr (string name)
3 {
4 return this. HelloWorld () + "->:" + name;
5}
Then, select a browser and click "run". I use Firefox)
6. If there is no running problem, you can see the following method: the default method and the added method.
7. Select GetStr () to test this method, enter a string, and click-> call
8. You can see the running result. The returned value is HelloWorld plus an input string.
9. Add? Wsdl allows you to view specific methods and parameters.
Ii. Release of WebService
1. Publish the WebServiceTest Project
Select a project-> release
2. Select New configuration file and enter a name
Configuration File
Connection
Connection
Set
3. Preview and release
4. Release completed
Iii. IIS deployment of WebService
1. Deploy and release projects on IIS
Create a website
2. Enter the website name and physical path, and bind the port number.
3. modify the application pool