jQuery Ajax to asp.net asmx web service throws Request format is invalid: application/json

前端 未结 2 1281
别那么骄傲
别那么骄傲 2021-01-05 04:54

I have jquery call an asp.net webservice with an integer. On our legaacy application which was ported to .net 4.0 I cannot get this call to work. I can call a method which h

相关标签:
2条回答
  • 2021-01-05 05:21

    DOH, I was working in the wrong web.config.

    Like a lot of questions on SO the solution was to add the following.

    <system.webServer>
            <handlers>
                <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            </handlers>
      </system.webServer>
    
    0 讨论(0)
  • 2021-01-05 05:35

    I had the same problem and ending up running this command...

    C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis.exe -i
    

    Note that you will need your command prompt in Administrator mode for it to work.

    0 讨论(0)
提交回复
热议问题