【问题标题】:Getting the error Client found response content type of 'text/html; charset=utf-8', but expected 'application/soap+xml'?获取错误客户端发现响应内容类型为'text/html; charset=utf-8',但预期为 'application/soap+xml'?
【发布时间】:2011-06-17 04:09:20
【问题描述】:

在我的本地机器上,我打开了 IIS,创建了虚拟目录,构建了代码并尝试启动网页,但是我收到以下错误 --

"System.InvalidOperationException: 客户端发现响应内容类型为 '文本/html;字符集=utf-8',但是 预期的“应用程序/soap+xml””

谁能告诉我如何纠正这个问题。使用的平台是 Windows 7,使用 Visual Studio 2005、C#.NET。 我是新手,从来没有研究过这些。

请帮助我。 提前致谢。

【问题讨论】:

  • 你构建了什么代码?你从哪里得到异常?你能发布你的代码吗?

标签: c# iis web-applications


【解决方案1】:

您似乎正在使用 SOAP1.1(使用 de 内容类型 text/xml )而不是 SOAP1.2(使用 conte 类型 application/soap+xml)。

在您的 web.config 中添加:

<system.web>
        <webServices>
        <protocols>
            <add name="HttpSoap"/>
                        <add name="HttpSoap12"/>
        </protocols>
    </webServices>
</system.web>

它使您的 Web 服务接受 SOAP1.1 和 SOAP1.2 请求。

如果您正在处理客户端部分,则必须为您的客户端应用程序激活 SOAP1.2 协议。没有代码和解释就不能再说了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-02-06
    • 1970-01-01
    • 1970-01-01
    • 2010-11-05
    • 2019-05-28
    • 2020-04-25
    • 1970-01-01
    • 2023-03-30
    相关资源
    最近更新 更多