2010-06-28 2 views
0

나는 잃어버린 ... 정확히 무슨 일이 일어나고 있는지 확실하지 않습니다. 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> 
+0

app.config 파일이 아닌 코드로 바인딩을 설정하려고 했습니까? NetTcpBinding에 대한 작업 설정이 있지만 BasicHttpBinding을 사용하여 여기에 붙여 넣지 않으려 고합니다. – Alan

+1

아니요, 코드를 사용해 보았습니다. 내가 코드 대 구성에서 바인딩하면 어떤 차이가 있습니까? –

+0

이론적으로는 아무것도 없습니다. 그러나 net.tcp로 문제를 해결하기 위해 싸워야했지만 클라이언트 측에서 코드 기반 솔루션을 사용해야하는 사례가있었습니다 (http://geekswithblogs.net/RandyMichak/archive/ 참조). 2009/03/04/programattically-setting-the-maxitemsinobjectgraph-property-in-client.aspx) – Alan

답변

0

100 % 확인 -하지만 당신은 확실히 약간의 비린내 일이 당신의 주소를 진행해야 서버 설정에서

.... 당신은 :

<baseAddresses> 
    <add baseAddress="http://myapp.com/"/> 
</baseAddresses> 

및 클라이언트 측 눌러 확인에 아직

<endpoint bindingConfiguration="BasicHttpBinding_IMailer" 
      bindingName="BasicHttpBinding_IMailer" binding="basicHttpBinding" 
      address="http://myapp.com/" 
      contract="Application.Services.Local.Mail.IEmailer"> 

을 g를 사용하면

<client> 
    <endpoint address="http://myapp.com/Mail/Mailer.svc" ... /> 
</client> 

그래서 주소는 무엇입니까? IIS에서 WCF 서비스를 호스팅하는 경우 서버 측 구성에 아무 것도 필요하지 않다고 생각합니다. <baseAddresses>이나 address=도 실제로 주소가 어떻게 표시되는지는 잘 모르겠습니다. 서버 이름 및 가상 디렉터리의 이름과 그 안에 포함 된 * .svc 파일의 이름과 확장명에 따라 결정됩니다.

그러나 실제, 실제 엔드 포인트는 모든 사용자 지정 설정을하지 않고, 대신 기본 설정을 사용할 수 있도록 이러한 잘못된 주소, 잘못된 구성으로 이어질 수 .... 서버를 정리하는

시도 측면 설정 - 그게 전혀 도움이 되나요 ??

+0

이상한 점은 정확한 클라이언트 구성을 사용하는 ASP.NET MVC 앱이 있고 작동하고 있다는 것입니다. WinApp을 만들었을 때부터 문제가 있습니다. –

+0

나는 아직 그것을 정리하지 않았고 마감일로 인해 다른 길을가는 것으로 끝났다. 그러나 이것이 이것이 해결책의 일부라고 확신합니다. –

관련 문제