内容类型 text/html;响应消息的 charset=UTF-8 与绑定的内容类型不匹配 (text/xml; charset=utf-8) [英] The content type text/html; charset=UTF-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8)

查看:213
本文介绍了内容类型 text/html;响应消息的 charset=UTF-8 与绑定的内容类型不匹配 (text/xml; charset=utf-8)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用独立应用程序创建了 WCF 服务并测试了 WCF 客户端.我可以使用 Internet Explorer 查看此服务,也可以在 Visual Studio 服务引用中查看.这是错误信息.

I created WCF service and testing WCF client using stand alone application. I was able to view this service using Internet Explorer also able to view in Visual studio service references. Here is the error message.

响应消息的内容类型 text/html;charset=UTF-8 与绑定的内容类型(text/xml;charset=utf-8)不匹配."

你能告诉我什么地方出了问题吗?

Could you please advice what could be wrong?

谢谢.

推荐答案

由于返回的内容类型是 text/html,我怀疑您的调用导致 WCF 之外的服务器端错误(您正在接收 HTML 错误页面).

Since the returned content type is text/html, I suspect your call result in a server-side error outside of WCF (you are receiving an HTML error page).

尝试使用网络调试代理查看响应,例如 Fiddler.

Try viewing the response with a web debugging proxy such as Fiddler.

(根据评论编辑):

根据您的评论,我发现您的 WCF 托管在 Sharepoint 2010 下的表单验证站点中.

Based on your comments, I see that your WCF is hosted under Sharepoint 2010, in a form-authenticated site.

您收到的错误是由于您的 WCF 客户端未通过 sharepoint 进行身份验证——它没有有效的身份验证 cookie.Sharepoint 然后返回一个 HTTP 重定向到一个 html 页面(login.aspx 页面);这不是您的 WCF 客户端所期望的.

The error you are receiving is due to the fact that your your WCF client is NOT authenticated with sharepoint -- it does not have a valid authentication cookie. Sharepoint then return an HTTP Redirect to an html page (the login.aspx page); which is not expected by your WCF client.

要更进一步,您必须从 Sharepoint 获取身份验证 cookie(请参阅 AuthenticationWeb 服务)并将其传递给您的 WCF 客户端.

To go further you will have to obtain an authentication cookie from Sharepoint (see Authentication Web Service) and pass it to your WCF client.

(更新编辑):

错误:该站点使用基于声明的身份验证.

Mistake: The site is using claim based authentication.

虽然这不一定是由于 cookie 或表单身份验证,但提供的错误消息的解释保持不变.身份验证问题会导致重定向到 WCF 客户端不处理的 HTML 页面.

Although this is not necessarily due to cookies or form authentication, the explaination of the provided error message remain the same. An authentication problem cause a redirection to an HTML page, which is not handled by the WCF client.

这篇关于内容类型 text/html;响应消息的 charset=UTF-8 与绑定的内容类型不匹配 (text/xml; charset=utf-8)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆