- new-->project--> Visual c#-->asp.net Web Service Application, creating a good WebService project
- Modify Service2.asmx named Myservice.asmx (rename right-click the file and view tag)
<% @ WebService language= "C #" Codebehind=" MyService.asmx.cs " class=" Webservice2.service2 " Span style= "Background-color:yellow" >% ;
changed to Span style= "Background-color:yellow" ><% @ WebService language= "C #" Codebehind=" MyService.asmx.cs " class=" Webservice2.myservice " Span style= "Background-color:yellow" >% ;
- Rebuild the project, right-click the Myservice.asmx file, "View in Browser", to check if the project has syntax errors
- Adding methods to the Myservice.asmx file
- Publish in-place mode: Upload the file under the bin file and the asmx file of the directory with the bin (including the. dll and. pdb files) to the extranet.
- Using the WebService interface: Create a new normal Windows application, right-click, add Web Reference
Web reference URL Behavior property: Sets the URL behavior to a static default value, and when the proxy class instance is created, the class uses a hard-coded URL to set the URL property
???????????????? If the rul behavior of the Web reference is set to dynamic, the application runs from the appsetting element of the application's configuration file to get the URL
- How to: Create a proxy class instance to use hopewebservice.myservice obj = new Hopewebservice.myservice ();
???????????? MessageBox.Show ("name is:" +? ) Obj.getname() + "; Age is:" +? Obj.getage());
C # WebService Small case