使用Post调用以asmx形式提供的webservice时,在本机调试没有调用问题。一旦部署至服务器后会提示如下信息:

<html>
<head>
<title>因 URL 意外地以“/GetCertByToken”结束,请求格式无法识别。</title>
<meta name="viewport" content="width=device-width" />
<style>
body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}
.marker {font-weight: bold; color: black;text-decoration: none;}
.version {color: gray;}
.error {margin-bottom: 10px;}
.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
@media screen and (max-width: 639px) {
pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }
}
@media screen and (max-width: 479px) {
pre { width: 280px; }
}
</style>
</head> <body bgcolor="white"> <span><H1>“/”应用程序中的服务器错误。<hr width=100% size=1 color=silver></H1> <h2> <i>因 URL 意外地以“/GetCertByToken”结束,请求格式无法识别。</i> </h2></span> <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "> <b> 说明: </b>执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 <br><br> <b> 异常详细信息: </b>System.InvalidOperationException: 因 URL 意外地以“/GetCertByToken”结束,请求格式无法识别。<br><br> <b>源错误:</b> <br><br> <table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code> 执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。</code> </td>
</tr>
</table> <br> <b>堆栈跟踪:</b> <br><br> <table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code><pre> [InvalidOperationException: 因 URL 意外地以“/GetCertByToken”结束,请求格式无法识别。]
System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) +675
System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) +259
System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +81
System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +375
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +195
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +128
</pre></code> </td>
</tr>
</table> <br> <hr width=100% size=1 color=silver> <b>版本信息:</b> Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.7.3282.0 </font> </body>
</html>

  

解决方案:

修改web.config文件,增加如下内容即可。

<system.web>
<webServices>
<protocols>
<add name="HttpGet" />
<add name="HttpPost" />
<add name="Unknown" />
<add name="HttpSoap" />
</protocols>
</webServices>
</system.web>

  

.asmx支持post请求或者get请求调用(WebService "因 URL 意外地以 结束,请求格式无法识别" 的解决方法)的更多相关文章

  1. WebService "因 URL 意外地以 结束,请求格式无法识别" 的解决方法

    最近在做一个图片上传的功能,js调用用webservice进行异步访问服务器,对于不是经常用webservice的菜鸟来说,经常会遇到以下的问题(起码我是遇到了) 在页面上写了js调用代码如下所示: ...

  2. (转)jdbc 调用 sql server 的存储过程时“该语句没有返回结果集”的解决方法

    本文转载自:http://hedyn.iteye.com/blog/856040 在JDBC中调用SQL Server中的存储过程时出现如下异常: com.microsoft.sqlserver.jd ...

  3. 使用layui异步请求上传图片在tp5.1环境下出现“请对上传接口返回json”的错误的解决方法

    正常情况下返回json数据使用return json(); 但是使用layui会报错,然后想到了使用json_encode()包装一下用一个变量接收后,再使用return();返回接收json格式的变 ...

  4. Java调用存储过程时报 The user specified as a definer ('root'@'%') does not exist 解决方法

    Caused by: java.sql.SQLException: The user specified as a definer (''@'') does not exist        at c ...

  5. SQLServer调WebService & 错误解决:请求格式无法识别

    (sqlServer 2008 + VS2010) 首先,对服务器进行配置. sp_configure ; GO RECONFIGURE; GO sp_configure ; GO RECONFIGU ...

  6. Android 调用webservice并解析

    这是调用webService的具体方法 private final static String nameSpace="http://tempuri.org/"; private f ...

  7. ASP.NET实现二维码 ASP.Net上传文件 SQL基础语法 C# 动态创建数据库三(MySQL) Net Core 实现谷歌翻译ApI 免费版 C#发布和调试WebService ajax调用WebService实现数据库操作 C# 实体类转json数据过滤掉字段为null的字段

    ASP.NET实现二维码 using System;using System.Collections.Generic;using System.Drawing;using System.Linq;us ...

  8. cxf 和 httpclient 客户端调用 webservice 接口

    一.cxf 生成 webservice 客户端 1.接口路径 http://ws.webxml.com.cn/WebServices/WeatherWS.asmx 2.进入你需要放置 webservi ...

  9. Java动态调用webService,axis2动态调用webService

    Java动态调用webService axis2动态调用webService >>>>>>>>>>>>>>>& ...

随机推荐

  1. centos下彻底删除mysql的方法

    本文记录了CentOS下MySQL的彻底卸载,供大家参考,具体内容如下: 1.查看MySQL是否安装 方式1: [root@localhost usr]# yum list installed mys ...

  2. 三、TensorFlow模型的保存和加载

    1.模型的保存: import tensorflow as tf v1 = tf.Variable(1.0,dtype=tf.float32) v2 = tf.Variable(2.0,dtype=t ...

  3. 1.9 分布式协调服务-Zookeeper(二)

    zoo.cfg配置文件分析 tickTime=2000  zookeeper中最小的时间单位长度 (ms) initLimit=10  follower节点启动后与leader节点完成数据同步的时间 ...

  4. Javascript实现base64的加密解密【转】

    场景 这几天使用PHP向前端传值的时候,遇到一个问题,要将代码传过去赋值.如果使用urlencode()和urldecode()函数,就会出现js无法解码的情况,因为php和js的相关函数算法不一致. ...

  5. jQuery使用(十二):工具方法之ajax的无忧回调(优雅的代码风格)

    jQuery.ajax()方法的应用 jQuery.ajax()的无忧回调(优雅的代码风格) 一.jQuery.ajax()方法的应用 jQuery.ajax()实质上就是在ajax的基础上进行了封装 ...

  6. Spring Cloud微服务实践之路-起始

    由于各种原因,公司要对现有的营销产品进行微服务化,如果可以,则对公司所有产品逐步进行微服务化. 而本人将探索这条路,很艰难,但干劲十足.整个过会记录下来,以便以后查阅. 感谢公司!感谢领导! 相关书籍 ...

  7. 20155324《网络对抗》Exp2 后门原理与实践

    20155324<网络对抗>Exp2 后门原理与实践 20155324<网络对抗>Exp2 后门原理与实践 常用后门工具实践 Windows获得Linux Shell 在Win ...

  8. 最短路径(Dijkstra算法)

    算法局限性:边的权值不能为负. 需要两个辅助数组dist[],path[],分别记录起点到各点的最短距离和最短路径 算法步骤: 1.根据起点v0初始化dist[]和path[]数组. 2.在剩下的点中 ...

  9. git add . 提示 `Changes not staged for commit`

  10. 简单的Web日志处理细节