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

news/2024/7/5 1:47:59

使用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) +675System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) +259System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +81System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +375System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +195System.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>

  

 

转载于:https://www.cnblogs.com/netwenchao/p/10762190.html


http://lihuaxi.xjx100.cn/news/235421.html

相关文章

警惕jdk8 UDP和Thread.interrupt的Bug

背景 线上业务在热点流量大的情况下&#xff08;业务采用Java编程语言实现&#xff09;&#xff0c;单机偶发出现Hystrix熔断&#xff0c;接口无法提供服务。如下图所示&#xff1a; Hystrix circuit short-circuited and is OPEN 代表Hystrix在一个窗口时间内失败了N次&…

Robot Framework(十八) 支持工具

5支持工具 5.1库文档工具&#xff08;libdoc&#xff09; libdoc是一种用于为HTML和XML格式的测试库和资源文件生成关键字文档的工具。前一种格式适用于人类&#xff0c;后者适用于RIDE和其他工具。Libdoc也没有很少的特殊命令来显示控制台上的库或资源信息。 可以创建文档&…

[SCOI2009]生日礼物

这道题很容易看出是一道单调队列题。 首先我们根据珠子的位置排序。 然后按顺序枚举一个个珠子。 如果该种珠子没有出现过标记上它的位置&#xff0c;如果出现过修改并打上当前位置。当所有珠子都出现后&#xff0c;将当前位置减去打标记位置最小的一个即为当前解。 可以证明正…

activity的四种加载模式

在android里&#xff0c;有4种activity的启动模式&#xff0c;分别为&#xff1a; standard, singleTop, singleTask和singleInstance, 其中standard和singleTop类似&#xff0c; singleTask和singleInstance类似&#xff0c; 用法如下&#xff1a; (1).standard和singleTop 这…

UIWebView、WKWebView使用详解及性能分析

一、整体介绍 UIWebView自iOS2就有&#xff0c;WKWebView从iOS8才有&#xff0c;毫无疑问WKWebView将逐步取代笨重的UIWebView。通过简单的测试即可发现UIWebView占用过多内存&#xff0c;且内存峰值更是夸张。WKWebView网页加载速度也有提升&#xff0c;但是并不像内存那样提…

数据库服务器 之 PostgreSQL数据库的日常维护工作

来自&#xff1a;LinuxSir.Org摘要&#xff1a;为了保持所安装的 PostgreSQL 服务器平稳运行, 我们必须做一些日常性的维护工作。我们在这里讨论的这些工作都是经常重复的事情&#xff0c; 可以很容易地使用标准的 Unix 工具&#xff0c;比如cron 脚本来实现; 目录1. 综述&…

WKWebView 的使用简介

1. navigationDelegate [objc] view plaincopy print?- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation { // 类似UIWebView的 -webViewDidStartLoad: NSLog("didStartProvisionalNavigation"); [UIAppli…

Codeforces Educational round 58

Ediv2 58 随手AK.jpgD 裸的虚树&#xff0c;在这里就不写了 E 傻逼贪心&#xff1f;这个题过的比$B$都多.jpg #include <cstdio> #include <algorithm> #include <cmath> #include <cstring> #include <cstdlib> #include <queue> #includ…