C # WebService Small case

Source: Internet
Author: User

  1. new-->project--> Visual c#-->asp.net Web Service Application, creating a good WebService project
  2. 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" >% ;

  3. Rebuild the project, right-click the Myservice.asmx file, "View in Browser", to check if the project has syntax errors
  4. Adding methods to the Myservice.asmx file
  5. 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.
  6. 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

  7. 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

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.