WCF 服务器错误.响应消息的内容类型 text/html 与绑定的内容类型不匹配 [英] WCF Server Error. The content type text/html of the response message does not match the content type of the binding

查看:29
本文介绍了WCF 服务器错误.响应消息的内容类型 text/html 与绑定的内容类型不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 WCF 服务,它调用 Web 服务,在我的开发 IIS 服务器 (IIS 7) 上运行.我已将其添加为 C# 网站项目的服务引用,并且效果很好.

I've got a WCF Service, which calls a webservice, running on my development IIS server (IIS 7). I've added it as a service reference to a C# Website Project and it adds fine.

但是,当我尝试调用任何服务合同时,出现以下错误:

However, when I try to call any of the service contracts, I get the following error:

内容类型 text/html响应消息的不匹配绑定的内容类型(文本/xml;字符集=utf-8).如果使用一个自定义编码器,请确保IsContentTypeSupported 方法是正确实施.第一个 1024响应的字节为:
'被阻止的网络页

The content type text/html of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were:
'Blocked Web Page

提前致谢

BB

推荐答案

错误消息清楚地表明:您返回的是 HTML 页面,而不是服务响应.查看错误消息中列出的该页面的片段,您可能未获得使用该服务的授权.

The error message says it clearly: you're getting back an HTML page instead of your service response. Looking at the fragment of that page listed in the error message, you're probably not authroized to use that service.

尝试在浏览器中连接到服务 URL - 您可能会看到一个页面,说明您无权访问该页面.这很可能是权限问题.

Try to connect to the service URL in a browser - you should probably see a page explaining that you're not allowed to access the page. Most likely, this is a permissions issue.

这篇关于WCF 服务器错误.响应消息的内容类型 text/html 与绑定的内容类型不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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