响应消息与内容类型异常不匹配

时间:2016-12-01 09:06:50

标签: wcf

[HttpPost]
public void Index(HttpPostedFileBase file)
{
    WebImage img = new WebImage(file.InputStream);
    if (img.Width > 1000)
       img.Resize(1000, 1000);
    img.Save("path");   
}

以上是我在WCF服务上编写并部署在服务器上的代码。第一次当我试图打电话时我得到http.web.helpers.dll丢失错误我把它添加到bin ...第二次我得到system.web.webPages.dll再次丢失异常我添加了它..第三次我得到了

  

内容类型text / html;响应消息的charset = utf-8与绑定的内容类型不匹配(text / xml; charset = utf-8)。       如果使用自定义编码器,请确保正确实现IsContentTypeSupported方法。

响应的前1024个字节是:

    <!DOCTYPE html>
        <html>
            <head>
                <title>Runtime Error</title>
                <meta name="viewport" content="width=device-width"/>
                <style>
                    body {font-family:"Verdana";font-weight:normal;font-size:.7em;color:black;}
                    p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
                    b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
                    H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
                    H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
                    pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}
                   .marker {font-weight: bold; color: black;text-decoration: none;}
                   .version {color: gray;}
                   .error {margin-bottom: 10px;}
                   .expandable { text-decoration:underline; font-weight:bold;color:navy; cursor:hand; }
                   @media screen and (max-width: 639px) {
                   pre { width: 440px; o'.}`

以下是我的web.config文件详细信息和服务配置。请检查我做错了什么。我甚至增加了超时,消息限制仍然得到同样的问题..即使在本地它工作正常..没有错误我得到。

<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_Iabcd" receiveTimeout="00:30:00"
     sendTimeout="00:30:00" maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
     maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
             useDefaultWebProxy="true"/>
  </basicHttpBinding>
</bindings>
<client>
 <endpoint address="http://abcd/abcd.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Iabcd"
    contract="abcd.Iabcd" name="BasicHttpBinding_Iabcd" />
</client>

任何人都可以帮我修理一下。我已更新了我的问题并添加了web.config文件

0 个答案:

没有答案