Call WebService - Request format is unrecognized for URL unexpectedly ending

转载 2015年07月06日 17:35:36


I have jquery call an asp.net webservice.

 

$.ajax({
        timeout: 10000,
        type: "POST",
        url: "AgentService.asmx/GetAgentData",
        data: JSON.stringify({ agentId: agentId }),
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (data, textStatus, xmlhttp) {

            if (data.d != null) {

                PopulateAgentData($popup, data.d);
            }
        },
        error: function (xmlhttp, errorMessage, exceptionObject) {

            HandlePopupError($popup, xmlhttp, errorMessage, exceptionObject);
        }
    });


Got following error

Request format is unrecognized for URL unexpectedly ending in /GetAgentData


I saw solution on internet

The solution in previous versions is to add this to the web.config for the protocols needed (typically omitting HttpGet for production):
<system.web>
  <webServices>
    <protocols>
      <add name="HttpGet" />
      <add name="HttpPost" />
      <add name="HttpSoap" />
    </protocols>
  </webServices>
</system.web>


I changed it.


Then, I got another exception:
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()


Finally,

I solved it 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.


Then, IISReset  /restart

Then, reboot Windows


相关文章推荐

解决mac使用svn: E170000: Unrecognized URL scheme for https://xxx错误

OS X版本:10.10.3 10.10.3自带了svn,但是版本是1.7,如果项目是使用1.8的svn,就必须升级到1.8,才能够正常使用。当前svn的最新版本是1.8.13。那么首先删除旧版本...
  • mhmyqn
  • mhmyqn
  • 2015-06-01 21:49
  • 10517

DM365 Boot Argument format for the Frame Buffer Driver is as follows

video=[davincifb|dm64xxfb|dm355fb] (keywords 'dm64xxfb' and 'dm355fb' are deprecated, 'davincifb' sh...
  • heanyu
  • heanyu
  • 2011-09-06 17:10
  • 1599

DM365 Boot Argument format for the Frame Buffer Driver is as follows

video=[davincifb|dm64xxfb|dm355fb] (keywords 'dm64xxfb' and 'dm355fb' are deprecated, 'davincifb' ...
  • maopig
  • maopig
  • 2012-03-31 23:25
  • 1407

Xcode8.2.1 bundle format unrecognized, invalid, or unsuitable

手机系统升级到10.2后 Xcode8.0 不支持 就任性的升级到Xcode8.1 那么你猜对了 坑来了  /Users/wudezhi/Library/Developer/Xcode/De...

-canOpenURL: failed for URL: "xx" - error:"This app is not allowed to query for scheme xx"

控制台输出如图是在我启动一个 Xcode 7 + iOS 9 的 App 之后,控制台的输出。这在 Xcode 6.4 + iOS 8 时,是不会有的情况,原因是【为了强制增强数据访问安全, iOS9...

iOS9.0 canOpenURL: failed for URL: "xx" - error:"This app is not allowed to query for scheme xx"

控制台输出 如图是在我启动一个 Xcode 7 + iOS 9 的 App 之后,控制台的输出。 这在 Xcode 6.4 + iOS 8 时,是不会有的情况,原因是【为了强制增强数据访问安全...

linux下安装svn 解决svn: Unrecognized URL scheme

svn安装   1、首先下载软件包,我是在weindows上下载后上传到linux下的(可以使用rz命令)   下载地址:http://download.csdn.net/detail/cyteven...

安装neon: Unrecognized URL scheme错误

Linux系统中缺省安装了SVN。使用rpm -e卸载后执行svn命令行操作就会出现标题中的错误。 # svn --version svn, version 1.4.6 (r28521)    com...

Unrecognized configuration section 'system.webServer' CKFinder - Setup Wizard for ASP

在配置ckfinder的时候遇到错误: Microsoft .NET Framework Version:1.1;ASP.NET Version:1.1; web.config文件: ---...

c#Request关于Url分析

  • 2017-01-16 15:29
  • 408KB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)