繁体   English   中英

wcf +响应消息的内容类型text / html与绑定的内容类型不匹配(application / soap + xml; charset = utf-8)

[英]wcf + The content type text/html of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8)

我遇到以下错误“ 响应消息的内容类型text / html与绑定的内容类型不匹配(application / soap + xml; charset = utf-8)。如果使用自定义编码器,请确保IsContentTypeSupported方法已正确实现。响应的前514个字节为” 以下是我的绑定和配置文件

  <customBinding>
                <binding name="LoginServiceSoap12Binding">
                    <textMessageEncoding messageVersion="Soap12" />
                    <httpsTransport />
                </binding>
            </customBinding>

<endpoint address="WCF URL"
             binding="customBinding" bindingConfiguration="LoginServiceSoap12Binding"
             contract="CWALoginService.LoginServicePortType" name="LoginServiceHttpsSoap12Endpoint" />

什么是不确定我在这里面临的问题...

多数情况下,这意味着您的主机返回错误页面(因为内容类型为所述的text/html ),而不是您的服务在application/soap+xml返回响应。

您应该通过输入服务的URL( http(s)://localhost{:port}/{subSite}/(WCF URL).svc )检查服务是否可以成功激活。 如果您的服务可以被激活,那么接下来您应该尝试的是通过以下步骤在客户端和服务端启用wcf跟踪:

  • 右键单击您的web.config / app.config,然后单击“ Edit WCF Configuration
  • Diagnostics部分,启用Log Auto FlushMessageLoggingTracing ,当然指定您的主机的身份访问写的路径。
  • 执行该服务调用后,请检查跟踪文件。 然后,您应该查看主机返回的html并找出真正的问题是什么。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM