简体   繁体   English

客户发现响应内容类型为“text / html”,但预期为“text / xml”

[英]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引用的代码,并在抛出异常之前检查响应的文本。

I have found Fiddler to be highly useful in debugging http client server issues. 我发现Fiddler在调试http客户端服务器问题时非常有用。 It is a proxy that allows you to intercept and even change the content of the request and response. 它是一个代理,允许您拦截甚至更改请求和响应的内容。

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.

相关问题 客户发现响应内容类型为'text / html; charset = iso-8859-1”,但预期为“ text / xml” - Client found response content type of 'text/html; charset=iso-8859-1', but expected 'text/xml' 调用WebMethod“客户端发现响应内容类型为'text / html; charset = us-ascii',但预期为'text / xml'时发生错误 - Error occurs on calling the WebMethod "Client found response content type of 'text/html; charset=us-ascii', but expected 'text/xml' .NET Web服务客户端-客户端发现响应内容类型为“文本/纯文本”,但预期为“文本/ xml” - .NET Web Service Client - Client found response content type of 'text/plain', but expected 'text/xml' 收到错误消息,客户端发现响应内容类型为'text / html; charset = utf-8”,但预期为“ application / soap + xml”? - Getting the error Client found response content type of 'text/html; charset=utf-8', but expected 'application/soap+xml'? 客户端发现响应内容类型为“”,但预期为'text / xml'。请求失败,响应为空 - Client found response content type of " but expected 'text/xml' The request failed with an empty response 客户端发现响应内容类型为“ application / wsdl + xml”,但预期为“ text / xml” - Client found response content type of 'application/wsdl+xml', but expected 'text/xml' WebForms ReportViewer控件错误。 “客户发现响应内容类型为”,但预期为'text / xml'。” - WebForms ReportViewer control error. “Client found response content type of '', but expected 'text/xml'.” 在C#中调用webservice返回客户端找到的响应内容类型'',但预期'text / xml' - Calling webservice in C# returns Client found response content type of '', but expected 'text/xml' 客户发现响应内容类型为“应用程序/ pdf”,但预期为“文本/ xml”。 请求失败,并显示错误消息: - Client found response content type of 'application/pdf', but expected 'text/xml'. The request failed with the error message: 报告查看器错误消息“客户端找到响应内容类型''但预期'文本xml'请求失败并显示空响应。” - Report viewer Error message “client found response content type of '' but expected 'text xml' The request failed with an empty response.”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM