我们的生产环境是:
IIS 6.0
.Net framework 4.0
ASP.Net 4.0线程池
但是,在生产服务器上调用任何Web方法时,例如:
[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public void Authenticate(string usrname, string challenge)
它回复:
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
我的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>
和
<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>
我非常确定所有Web方法在我的开发主机中都能正常运行。 请劝告。
由于