나는 잃어버린 ... 정확히 무슨 일이 일어나고 있는지 확실하지 않습니다. Google에서 50 페이지 이상을 읽었으며이 답변을 위해 StackOverflow를 샅샅이 조사했습니다. 이 코드를 실행하면 오류 메시지가 계속 표시됩니다.WCF - Win App "XML 데이터를 읽는 동안 최대 문자열 내용 길이 할당량 (8192)이 초과되었습니다."
"매개 변수 http://tempuri.org/:message을 역 직렬화하는 동안 오류가 발생했습니다. InnerException 메시지가 'Application.Interfaces.Mail.MailMessage 형식의 개체를 deserialize하는 동안 오류가 발생했습니다. XML 데이터를 읽는 동안 최대 문자열 내용 길이 할당량 (8192)이 초과되었습니다 .XML 판독기를 만들 때 사용되는 XmlDictionaryReaderQuotas 객체의 MaxStringContentLength 속성을 변경하면이 할당량을 늘릴 수 있습니다. ''
다음은 내가 가지고있는 것입니다. WCF 서비스 (서버) :
<system.serviceModel>
<services>
<service behaviorConfiguration="SimpleServiceBehavior" name="Application.Services.Mail.Mailer">
<host>
<baseAddresses>
<add baseAddress="http://myapp.com/"/>
</baseAddresses>
</host>
<endpoint bindingConfiguration="BasicHttpBinding_IMailer" bindingName="BasicHttpBinding_IMailer" binding="basicHttpBinding" address="http://myapp.com/" contract="Application.Services.Local.Mail.IEmailer">
<identity>
<dns value="myapp.com"/>
</identity>
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="SimpleServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IMailer" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="800000" maxBufferPoolSize="800000" maxReceivedMessageSize="800000" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="800000" maxStringContentLength="800000" maxArrayLength="800000" maxBytesPerRead="800000" maxNameTableCharCount="800000" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
그리고 클라이언트 측에 어떤 : 그게 문제가 있다면
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IMailer" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="5242880" maxBufferPoolSize="524288" maxReceivedMessageSize="5242880" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://myapp.com/Mail/Mailer.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMailer" contract="Interfaces.Mail.IEmailer" name="BasicHttpBinding_IMailer"/>
</client>
</system.serviceModel>
app.config 파일이 아닌 코드로 바인딩을 설정하려고 했습니까? NetTcpBinding에 대한 작업 설정이 있지만 BasicHttpBinding을 사용하여 여기에 붙여 넣지 않으려 고합니다. – Alan
아니요, 코드를 사용해 보았습니다. 내가 코드 대 구성에서 바인딩하면 어떤 차이가 있습니까? –
이론적으로는 아무것도 없습니다. 그러나 net.tcp로 문제를 해결하기 위해 싸워야했지만 클라이언트 측에서 코드 기반 솔루션을 사용해야하는 사례가있었습니다 (http://geekswithblogs.net/RandyMichak/archive/ 참조). 2009/03/04/programattically-setting-the-maxitemsinobjectgraph-property-in-client.aspx) – Alan