C # using WebService

Source: Internet
Author: User

First, the new webservice
    1. New Project →asp.net Web Service Application
    2. or right-click the new Web service program ASMX in an existing project
    3. As long as the method inside the WebService class is labeled "WebMethod", it becomes the method that others can adjust. Two, WebService call

After the reference, you can directly use the method inside the namespace class name Client=new class; Method ()

Common errors

① failed to load the endpoint configuration portion of the contract as "Servicereference1.interfacesoap" because multiple endpoint configurations for the contract were found. Please indicate preferred by name

If the above error is due to the first reference to the WebService in the Webconfig has generated the <endpoint> configuration node, the first run time again added a configuration node repeat, You need to manually delete a node because the Add external reference is referenced more than once in the Web. config file

<client> <endpoint address="Http://218.90.168.115:8000/PJSDFacade/PJSD/Interface.asmx"binding="BasicHttpBinding"bindingconfiguration="Interfacesoap"Contract="Servicereference1.interfacesoap"Name="Interfacesoap"/>
<!--the node below is removed--<endpoint address="Http://218.90.168.115:8000/PJSDFacade/PJSD/Interface.asmx"binding="custombinding"bindingconfiguration="INTERFACESOAP12"Contract="Servicereference1.interfacesoap"Name="INTERFACESOAP12"/> </client>
So delete a node can be (if the reference is Webservicesoap, delete the WebServiceSoap1 of the relevant node, and vice versa ~new webservicesoapclient (" Interfacesoap");

C # using WebService

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.