An error occurred while calling asmx using jquery Ajax.

Source: Internet
Author: User

1. // to allow ASP. Net ajax to call this web service from a script, cancel the comments to the downstream.

[System. Web. Script. Services. scriptservice]

This error has clearly been prompted, and the chance of making a mistake is not very high.

2. Add the following configuration section in the <system. Web> </system. Web> section of Web. config:

<WebServices>

<Protocols>
<Add
Name = "httpsoap"/>
<Add
Name = "httppost"/>
<Add
Name = "httpget"/>
<Add
Name = "documentation"/>

</Protocols>
</WebServices>

I tried, but the second method still didn't work. So I went on to find a jquery Ajax call to. net.
The example of WebService, so I tried to download it. People's code works. After comparison, why is the same Code invalid? Troubleshoot the problem:

After deleting the Web. config file, the problem is obviously still found in the web. config file. Find the code that may be affected, exclude one sentence, and finally find:

<Httphandlers> under <system. Web> has the following sentence:

<Add verb = "*" Path = "*. asmx"
Validate = "false" type = "system. Web. Script. Services. scripthandlerfactory,
System. Web. Extensions, version = 3.5.0.0, culture = neutral,
Publickeytoken = 31bf3856ad364e35 "/>

This sentence is valid. If it is removed, it is invalid and excited. Stick this sentence to my web. confg and solve the problem. It only took two hours!

Related Article

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.