Here I will not described in detail how the release webservice, how to use a direct say.
First, the post is complete, open the file WebService in the browser, such as: HTTP: //localhost/WebSer/WebService1.asmx , you can see the function WebService1.asmx files available for calls.
2, the address in the address bar to modify HTTP: //localhost/WebSer/WebService1.asmx wsdl? , You can see WebService1.asmx file displayed in XML format. Save this file as WebService1.wsdl, save to your hard drive, such as the D drive.
3, Start -> All Programs -> Microsoft Visual Studio 2010-> Visual Studio Tools-> Visual Studio Command Prompt (2010), the pop-up DOS screen, enter wsdl / language: c # / n : TestDemo / out: d: /Temp/TestService.cs D: /Temp/TestService.wsdl
例如:D:/Program Files/Microsoft Visual Studio 8/VC>wsdl /language:c# /n:TestDemo /out:d:/Temp/TestService.cs D:/Temp/TestService.wsdl
You can see generated a TestService.cs file (under the same directory and TestService.wsdl)
Then enter the command:
csc /out:TestService.dll / t: Enter Library TestService.cs
in the same directory as the file created under the TestService.dll.
Parameter Description: language generated by the language type
testDemo: namespace
/ Out: output path (d: /Temp/TestService.cs file is generated)
Note: D: /Temp/TestService.wsdl is wsdl path, the path may be url: HTTP:? Wsdl //localhost/Temp/Test.asmx
Second, the use of files generated, if .cs class, directly added to the project in on OK. If you use a .dll, directly add a reference to OK!
Reproduced in: https: //www.cnblogs.com/baishiying/p/3255381.html