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!