问题描述
我创建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;字符集=响应报文不匹配绑定的内容类型的UTF-8(文/ XML的,字符集= 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).
尝试查看与Web调试代理,如的响应。
Try viewing the response with a web debugging proxy such as Fiddler.
(基于评论编辑):
,我看你的WCF是2010 Sharepoint的主持下,在窗体身份验证的网站。
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(见验证Web服务),并把它传递给你的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或形式的认证,所提供的错误消息的交代保持相同。身份验证问题导致重定向到一个HTML页面,它不是由WCF客户端处理。
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;字符集= UTF-8的响应消息不匹配绑定的内容类型(文本/ XML的,字符集= UTF-8)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!