JQuery error for asmx on Windows 2008 R2 SP1

Since installing Service Pack 1, we have encountered problems when calling asmx pages from JQuery client code.

IIS points jQuery mail to its default 404 page.

We made the role of our environment to claim that this problem was caused by SP1, and tests confirm this.

Pending fix @MS

Technologies used:

ASP.Net 4.0 - JQuery - IIS 7.5 - Windows 2008 R2 SP1

- Bart

Example code call (front-end):

// Code to load vars... $.ajax({ type: "POST", url: "/Handlers/ProductRating.asmx/RateProduct", data: "{'uniqueId':'" + uniqueId + "','productId':'" + productId + "','points':" + points.toString() + ",'showOwnScore':" + showOwnScore.toString() + "}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(response) { alert('success'); }, failure: function(msg) { alert('something went wrong'); } }); } 

Internal Code Code:

  [ScriptService] public class ProductRating : System.Web.Services.WebService { [WebMethod(EnableSession=true)] public RateProductResponse RateProduct(Guid uniqueId, Guid productId, int points, bool showOwnScore) { //Implementation } 

Snapshot 1: Service Pack 1: http://img812.imageshack.us/i/capture2r.png/

Snapshot2: without SP1: http://img190.imageshack.us/i/capture1qx.png/

+4
source share
3 answers

I managed to get this working with the following addition to my web.config

I saw another site that suggested cleaning up handlers, but it made things worse. With this update, I was able to call my web services again.

 <system.webServer> <handlers> <add name="AsmxRoutingHandler" verb="*" path="*.asmx" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> </handlers> </system.webServer> 
+4
source

I had the same problem.

Create a Web.Config file containing the following lines:

 <?xml version="1.0" encoding="utf-8"?> <configuration> <location path="." inheritInChildApplications="false"> <system.web> <httpHandlers> <clear /> <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add path="*" verb="GET,HEAD,POST" type="System.Web.DefaultHttpHandler" validate="True" /> </httpHandlers> </system.web> </location> </configuration> 

Copy this to the directory (s) where you serve your affected scripts and restart the web server.

These lines will override the preferred HttpHandlers and use it instead to use the default handlers.

Good luck

0
source

Judging by your screenshots, this seems very terrible, like a problem with URL rewriting. Does your site have excessively greedy IIS-level URL rewriting rules that can be redirected to 302 /Handlers/ProductRating.asmx/RateProduct ?

If you have rewriting rules, can you temporarily disable them to find out if this fixes the ASMX problem?

0
source

Source: https://habr.com/ru/post/1345513/


All Articles