ASP.NET Ajax: 'PageMethods is undefined' script error on production server (works on localhost)
-
05-09-2019 - |
Question
In a javascript file I'm calling an ASP.NET Ajax PageMethod (ASP.NET 3.5), correctly defined in the page class a static method using the WebMethod attribute. This works on my development machine, but on the production server the PageMethod object is undefined when my javascript function is called (clicking a button).
Some debugging info:
- Error on Firefox and Internet Explorer
- According to Firebug's network tab all external resources are correctly loaded
- I'm using jQuery on the same page
- The application is deployed using a Web Deployment project
Any idea what's causing the problem?
Solution
I found the solution to the problem after having written the question. I'm doing a dirty trick in order to avoid copying the aspx placeholder files (Web Deployment Project) to the server: in IIS I've unchecked the .aspx ISAPI extension option "Verify that file exists".
That seems to be a problem for ASP.NET Ajax. So I created an empty aspx placeholder file and ... now it's working on the production server too. I'll put a warning sign on the question/answer I linked above.