I’m designing a web service (asmx) using the .NET framework 3.5 on an MVC site with the requirement to return JSON. Using some basic tutorials and the templates Visual Studio provides i was able to get a working model running on my laptop. When I deployed the solution to the server the results came back as XML.
I found the solution here. Since I am using .NET 3.5 for my web service, the handlers for the asmx are not included in the machine.config. Adding the following line under system.webServer fixed this issue.
<code><system.webServer> <handlers> <add name="ScriptHandlerFactory" verb="*" path="*.asmx" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=184.108.40.206, Culture=neutral, PublicKeyToken=31bf3856ad364e35" resourceType="Unspecified" /> </handlers> </system.webServer></code>