[英]Client found response content type of 'text/html', but expected 'text/xml'
I am getting this error: 我收到此错误:
Client found response content type of 'text/html', but expected 'text/xml.
客户发现响应内容类型为“text / html”,但预期为'text / xml。
I am adding web reference for live search. 我正在为实时搜索添加网络参考。 When i build the project its Successful.
当我构建项目时,它的成功。 But after that once i enter some text in textbox & enter search button it gives this error.
但之后,一旦我在文本框中输入一些文本并输入搜索按钮,就会出现此错误。 I am Using my local machine & Using .net 2.0 with C#.
我使用我的本地机器和使用.net 2.0与C#。
Plz help me... Plz帮帮我......
Thanks In Advance... 提前致谢...
As Matt said, it's probably an error page coming back. 正如马特所说,这可能是一个错误页面。
Either use a proxy like Fiddler or a network sniffer like WireShark to see what the raw response is - that should help you get to the bottom of what's going on. 使用像Fiddler这样的代理或像WireShark这样的网络嗅探器来查看原始响应是什么 - 这应该可以帮助您了解正在发生的事情。
Generally that error means that the service has sent back an (HTML) error message rather than the XML SOAP response that your client was expecting. 通常,该错误意味着服务已发回(HTML)错误消息,而不是客户端期望的XML SOAP响应。
For web services that you control it's really easy to find the problem, because you can invoke the webmethods by hand in your browser. 对于您控制它的Web服务,很容易找到问题,因为您可以在浏览器中手动调用Web方法。 To diagnose it when it's someone else's service is a little trickier.
当它是其他人的服务时诊断它有点棘手。 You might be able to trace into the code for your web reference and inspect the text of the response before the exception is thrown.
您可以跟踪Web引用的代码,并在抛出异常之前检查响应的文本。
In your actual code, replace the line: 在您的实际代码中,替换该行:
searchRequest.AppID = "APP ID you generated from ...";
with the actual AppID
, which should be a long alpha-numeric sequence
. 使用实际的
AppID
,它应该是一个long alpha-numeric sequence
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.