日期:2014-05-18  浏览次数:20989 次

web服务错误:因 URL 意外地以“/SearchByKeyWord”结束,请求格式无法识别。。。郁闷啊
做了一个web服务, 里面有3个接口, 通过3个接口返回在sqlserver中查询的表,并Fill到一个Dataset里面,最后return dataset。。。
完了以后调试出现先标题中的错误,详细情况如下:
堆栈跟踪: 

[InvalidOperationException: 因 URL 意外地以“/SearchByKeyWord”结束,请求格式无法识别。]
  System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) +405913
  System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) +212
  System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +47
  System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +193
  System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +93
  System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

 我以为是程序有问题,就在控制台下又编译了一遍, 成功运行。。。但是到这里怎么都有这个错误, SQL查询语句我试过了也没有问题。。。现在束手无策啊,希望大家帮帮忙~~~~
谢谢了~~~~~

------解决方案--------------------
在webservice的 <system.web> 节点下加入 
<webServices> 
<protocols> 
<add name= "HttpPost " /> 
<add name= "HttpGet " /> 
</protocols> 
</webServices> 

------解决方案--------------------
在webservice的 <system.web> 节点下加入
<webServices>
<protocols>
<add name= "HttpPost" />
<add name= "HttpGet" />
</protocols>
</webServices>
空格