Web Service is an operable distributed application. It uses soap as the basic communication protocol and uses HTTP and XML for free communication through the firewall.
Error message:
* An error occurred while accessing the IIS metadatabase.
* IIS cannot display XML
Solution: Start-> Program-> Microsoft Visual Studio 2005-> visual studiotools, open the command line, and enter the command: aspnet_regiis-I. Then, the. NET registration will be re-registered.
In addition, you need to open the Properties dialog box on the virtual directory, click ASP. NET properties page, and select the corresponding Asp.net version (1.1 or 2.0) from the "Asp.net version" item)
* No Permissions
Because we currently use NTFS hard disks, select everyone or enable Anonymous Access in IIS.
* Remove the Window System Integration user and select
1. First Add a new project --- Web Service --- *. asmx
A *. CS file is added to the app_code folder.
- Webmethod]
- PublicString [] gethotsearchbykeywords
- (String keyword)
- {
- ReturnSearchkeywordmanager. gethotsearchbykeywords
- (Keyword );
- }
- [Webmethod] is a feature provided by web service,
- It indicates that the following method is a web method, which allows the Web to call this method using soap.
- A Web service file can contain multiple [webmethods],
- A [webmethod] can only be used for the following methods:
After writing the file, you can open the file directly for testing. After the file is successfully opened, it can be published.
2. C # WebService released
C # WebService publish website --- create virtual directory --- browse WebService page --- test WebService Method
A small problem may occur during the release. The above error occurs.
Open the WebService URL, which is the URL of the WebService to be published.
3. C # WebService call
Add web reference --- instantiate WebService class --- execute WebService Method
WebService may be called in this project, not this project, or even in a remote location.
* Add a WebService reference
* Enter the published WebService URL in the URL and click "go". The published WebService method is displayed.
* You can change the WebService reference name.
C # WebService calls this method
Reference name. Class Name S = new reference name. Class Name ();
* After adding a reference, you will also see the files related to WebService added to the app_webreferences folder.
*. Disco
*. Discomap
*. WSDL