2

我收到以下错误

System.ServiceModel.ProtocolException: The content type text/html; charset=utf-8 of the response message does not match the content type of the binding (application/soap+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: '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title>Error Page</title>
<style type="text/css">
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td
{ margin: 0px;padding: 0px; font-family:Verdana, Arial, sans-serif;}
html{width: 100%;height: 100%;overflow: auto;}
a img { border: medium none;}
.outer_Container {text-align: center;}
.outer_Wrap {width: 1000px;margin: auto;text-align: left;}
.contentWrapper {width: 1000px;background-color: #fff;}
.header {float: left;width: 1000px;height: 84px; /*background-image: url("/errorPage/TopBlueGradient.png"); */ background-image: url("/utils/images/header_bknd.png");background-repeat: repeat-x;}
.tittleOuter { float: left; width: 630px; margin-left: 8px; margin-top: 20px;}
.tittle {width: 630px;float: left;font-size: 18px;color: #FFFFFF;line-height: 18px;}
.tittle_Sub {float: lef'.

Server stack trace: 
   at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding)
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
   at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Intel.IsvWebService.Client.IRefurbishService.CheckServiceStatus()
   at Intel.Refurbish.WebService.RefurbishWS.ATCheckServiceStatus(ServiceStatusRequest request)

只有前 1024 个字节被显示为引发错误的一部分。有没有办法可以将大小增加到无限,以便我可以看到完整的 HTML 代码?

4

2 回答 2

4

在 System.ServiceModel.Channels.HttpChannelUtilities 中:

Stream responseStream = webResponse.GetResponseStream();
long num = webResponse.ContentLength;
if (num < 0L || num > 1024L)
{
    num = 1024L;
}
// More code...

如果响应的长度较小,则硬编码以获取前 1024 个字节或更少。真的很烦人,因为根本错误最终在我的响应中进一步下降......

于 2017-06-12T13:25:56.523 回答
-1

增加 maxBufferPoolSize、maxBufferSize、maxReceivedMessageSize 和 readerQuotas 属性的大小。

前任:

 <netNamedPipeBinding>
    <binding
       name="NetNamedPipeBinding"
       openTimeout="00:01:00"
       receiveTimeout="00:01:00"
       sendTimeout="00:01:00"
       closeTimeout="00:01:00"
       hostNameComparisonMode="StrongWildcard"
       maxBufferPoolSize="2147483646"
       maxBufferSize="2147483646"
       maxConnections="500"
       maxReceivedMessageSize="2147483646"
       transactionFlow="false"
       transactionProtocol="OleTransactions"
       transferMode="Buffered">
      <security mode="Transport">
        <transport protectionLevel="EncryptAndSign" />
      </security>
      <readerQuotas maxArrayLength="2147483646"
                    maxBytesPerRead="2147483646"
                    maxDepth="999"
                    maxNameTableCharCount="2147483646"
                    maxStringContentLength="2147483646" />
    </binding>
  </netNamedPipeBinding>
于 2013-07-17T06:04:49.197 回答