zoukankan      html  css  js  c++  java
  • Ajax调用WebService之System.InvalidOperationException

               使用Ajax调用asp.net中的web service,你可能遇到这样的Exception:

    System.InvalidOperationException: Request format is unrecognized for URL unexpectedly ending in '/MethodName'
     
          .net中的WebService支持三种协议HTTPGET, HTTPPOST 和 SOAP。默认的SOAP是支持的,当你使用这样的格式时:
    domain/webservice.asmx/methodname [Get/Post] 做的则是GET OR POST。

              怎么解决呢,修改WEB.CONFIG文件如下配置节:

       1:      <webServices>
       2:        <protocols>
       3:          <add name="HttpSoap"/>
       4:          <add name="HttpGet"></add>
       5:          <add name="HttpPost"></add>
       6:        </protocols>
       7:      </webServices>

           增加GET和POST结点就可以了。当然你愿意,可以修改Machine.config。

    希望这篇POST对您有帮助。


    作者:Petter Liu
    出处:http://www.cnblogs.com/wintersun/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
    该文章也同时发布在我的独立博客中-Petter Liu Blog

  • 相关阅读:
    View Documentation in Web Using [openoffice.org 3+swftools+flexpaper]
    swfobject.js
    Java 文件上传组件 Apache Commons FileUpload 应用指南
    模拟HTML表单上传文件(RFC 1867)
    Using CURL to download a remote file from a valid URL in c++
    GUN tar for windows Practice
    Using libcurl in VC++
    Zlib Practice
    解决HtmlAgilityPack中文乱码
    Windows 7,Windows Server 2008 MSDTC配置
  • 原文地址:https://www.cnblogs.com/wintersun/p/1746060.html
Copyright © 2011-2022 走看看