2

Our production environment is:

  1. IIS 6.0

  2. .Net framework 4.0

  3. ASP.Net 4.0 thread pool

However, when calling to any web methods on the production server, for example:

    [WebMethod(EnableSession = true)]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public void Authenticate(string usrname, string challenge)

it responses:

System.InvalidOperationException: Request format is invalid: application/json; charset=UTF-8.
   at System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()
   at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()

---EDIT---

My web.config:

  <system.web>
    <sessionState cookieless="UseCookies" mode="StateServer" timeout="20"/>
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
    <webServices>
      <protocols>
        <add name="HttpGet"/>
        <add name="HttpPost"/>
      </protocols>
    </webServices>

and

  <system.webServer>
     <modules runAllManagedModulesForAllRequests="true"/>
        <!-- ##William#2012.03.22 ##Try Fixing: System.InvalidOperationException: Request format is invalid: application/json; charset=UTF-8 -->
        <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>

I'm pretty sure that all web methods work properly in my development host. Please kindly advise.

Thanks

William X
  • 6,751
  • 6
  • 31
  • 50

1 Answers1

1

please follow this steps

WCF method returning JSON / XML objects not working

It may help u

Thanx

Community
  • 1
  • 1
V_B
  • 1,571
  • 5
  • 16
  • 37