I have a rather old ASP.NET 4.5 application that is running on .NET Framework 4.7.2, which makes use of [WebMethod]
s called from .aspx
pages via jQuery. In our testing environment, these AJAX calls work fine, but when we deploy the same deployment package to production, the AJAX calls return 302 redirects to the home page.
The application uses a mix of WebForms and MVC.
Both environments are using Windows Server 2008 R2 SP1, and when I diff the web.config
s, the configurations are identical outside of the usual appSettings
and connectionStrings
and other custom configuration blocks.
If it was a route registration issue (e.g. Calling asp.net 4.5 web service returns 302 and redirects to default page) then I would expect it to fail in UAT as well in production. Any suggestions as to how I can fix this?
In the end, I decided life was too short to spend too long on fixing up legacy technologies, and just moved the web method codes into Controller action methods that returned ASP.NET AJAX-friendly JSON, and everything works again.
WebMethods, being static, are an abomination these days anyway, unless you love ServiceLocator.