2012-12-20 3 views
0

편집ASP.NET MVC 웹 응용 프로그램

내가 MVC 서비스가 소비 한 WCF 서비스의 메서드를 호출하고 다음과 같은 오류를 얻을려고 MVC 3 사용하고 있습니다 내가 그 방법을 부를 때. 메시지를 역 직렬화하는 동안

포맷터에서 예외가 발생했습니다 : 매개 변수 http://tempuri.org/:emailData를 역 직렬화하는 동안 오류가 발생했습니다. InnerException 메시지가 'EmailPO 유형의 객체를 비 직렬화하는 동안 오류가 발생했습니다. XML 데이터를 읽는 동안 최대 문자열 내용 길이 할당량 (8192)이 초과되었습니다. XML 판독기를 만들 때 사용되는 XmlDictionaryReaderQuotas 개체의 MaxStringContentLength 속성을 변경하면이 할당량을 늘릴 수 있습니다. 라인 89, 위치 1075 '. 자세한 내용은 InnerException을 참조하십시오.

이것은 내가 생각한 것처럼 ASP.NET과 관련이있는 것은 아닙니다. 로컬로 Cassini와 함께 작동하는이 서비스를 사용하는 WPF 응용 프로그램이 있습니다. 동일한 WPF 응용 프로그램을 사용하고이 동일한 WCF 서비스를 게시 한 후 서비스를 사용할 때 위의 오류가 동일한 메서드를 실행합니다.

ASP.NET MVC 클라이언트의 Web.config 작동하지 않습니다 :

<configSections>  
     <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > 
      <section name="UserInterface.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 
     </sectionGroup> 
     </configSections> 
     <!--<location path="~/Content/images" allowOverride="false"> 
     <system.web> 
      <authorization> 
      <allow users="*"/> 
      </authorization>  
     </system.web> 
     </location>--> 
     <system.serviceModel> 
     <bindings> 
      <basicHttpBinding> 
      <binding name="BasicHttpBinding_Configuration" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
        allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="1073741824" maxBufferPoolSize="1073741824" 
        maxReceivedMessageSize="1073741824" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> 
       <readerQuotas maxDepth="32" maxStringContentLength="65536" maxArrayLength="102400" 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://server1/WebServices/MasterEngine/MasterEngineService.svc?wsdl" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Configuration" contract="MasterEngineFarEnd.IMasterEngineService" name="BasicHttpBinding_IMasterEngineService" /> 
     --- Later on after company specific stuff -- 
<system.web>  
    <httpRuntime requestValidationMode="2.0" maxRequestLength="5120" executionTimeout="1200" />  
    <customErrors mode="Off" /> 
    <compilation debug="true" targetFramework="4.0"> 
     <assemblies> 
     <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
     <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
     <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
     <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
     <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
     <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />   
     </assemblies> 
    </compilation> 
    <authentication mode="Windows"></authentication> 
    <membership> 
     <providers> 
     <clear /> 
     <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" /> 
     </providers> 
    </membership> 
    <profile> 
     <providers> 
     <clear /> 
     <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" /> 
     </providers> 
    </profile> 
    <roleManager enabled="false"> 
     <providers> 
     <clear /> 
     <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" /> 
     <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" /> 
     </providers> 
    </roleManager> 
    <pages> 
     <namespaces> 
     <add namespace="System.Web.Helpers" /> 
     <add namespace="System.Web.Mvc" /> 
     <add namespace="System.Web.Mvc.Ajax" /> 
     <add namespace="System.Web.Mvc.Html" /> 
     <add namespace="System.Web.Routing" /> 
     <add namespace="System.Web.WebPages" /> 
     </namespaces> 
    </pages>   
    </system.web> 
    <system.webServer> 
    <!--<httpErrors errorMode="Custom" existingResponse="Replace"> 
     <remove statusCode="404" subStatusCode="-1" /> 
     <remove statusCode="500" subStatusCode="-1" /> 
     <error statusCode="404" path="/Error/NotFound" responseMode="ExecuteURL" /> 
     <error statusCode="500" path="/Error/Error" responseMode="ExecuteURL" /> 
    </httpErrors>--> 
    <validation validateIntegratedModeConfiguration="false" /> 
     <modules runAllManagedModulesForAllRequests="true"></modules> 
    <handlers> 
     <remove name="UrlRoutingHandler"/> 
    </handlers> 
    </system.webServer> 
    <runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> 
     <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Web.Routing" publicKeyToken="31bf3856ad364e35" culture="neutral" /> 
     <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /> 
     </dependentAssembly> 
    </assemblyBinding> 
    </runtime> 

WCF 서비스 (MasterEngine)의 Web.config을 에게 이 에게 이

WPF 응용 프로그램이 작동하지 않습니다

<system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_Configuration" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="1073741824" maxBufferPoolSize="1073741824" maxReceivedMessageSize="1073741824" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="1073741824" maxArrayLength="102400" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <security mode="None"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> <!-- OLD CONFIG <binding name="BasicHttpBinding_Configuration" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="8192" 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://server2/WebServices/InternalService/InternalService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Configuration" contract="InternalFarEnd.IInternalService" name="BasicHttpBinding_IInternalHubService" /> </client> </system.serviceModel> <system.web> <compilation debug="true" targetFramework="4.0" /> </system.web> <system.serviceModel> <behaviors> <serviceBehaviors> <behavior> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadata httpGetEnabled="true"/> <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer> </configuration> 

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <system.serviceModel> 

     <diagnostics> 
     <endToEndTracing propagateActivity="true" activityTracing="true" 
      messageFlowTracing="true" /> 
     </diagnostics> 
     <behaviors> 
     <endpointBehaviors> 
      <behavior> 
      <dataContractSerializer maxItemsInObjectGraph="2147483647" /> 
      </behavior> 
     </endpointBehaviors> 
     <serviceBehaviors> 
      <behavior> 
      <dataContractSerializer maxItemsInObjectGraph="2147483647" /> 
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
      <serviceMetadata httpGetEnabled="true"/> 
      <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
      <serviceDebug includeExceptionDetailInFaults="true"/> 
      </behavior> 
     </serviceBehaviors> 
     </behaviors> 

     <bindings> 
      <basicHttpBinding> 
       <binding name="BasicHttpBinding_Configuration" closeTimeout="00:01:00" 
        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
        allowCookies="false" bypassProxyOnLocal="false" maxBufferPoolSize="1073741824" 
        maxReceivedMessageSize="1073741824" useDefaultWebProxy="true"> 
        <readerQuotas maxDepth="1073741824" maxStringContentLength="1073741824" 
         maxArrayLength="1073741824" maxBytesPerRead="1073741824" maxNameTableCharCount="1073741824" /> 
       </binding> 
      </basicHttpBinding> 
     </bindings> 
     <client> 
      <endpoint address="http://server01-dev/WebServices/MasterEngine/MasterEngineService.svc" 
       binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Configuration" 
       contract="MasterEngineFarEnd.IMasterEngineService" name="BasicHttpBinding_IMasterEngineService" /> 
     </client> 
    </system.serviceModel> 
</configuration> 
다른 스레드로 최대-모든 추가를 통해

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <system.serviceModel> 

     <diagnostics> 
     <endToEndTracing propagateActivity="true" activityTracing="true" 
      messageFlowTracing="true" /> 
     </diagnostics> 
     <behaviors> 
     <endpointBehaviors> 
      <behavior> 
      <dataContractSerializer maxItemsInObjectGraph="2147483647" /> 
      </behavior> 
     </endpointBehaviors> 
     <serviceBehaviors> 
      <behavior> 
      <dataContractSerializer maxItemsInObjectGraph="2147483647" /> 
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
      <serviceMetadata httpGetEnabled="true"/> 
      <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
      <serviceDebug includeExceptionDetailInFaults="true"/> 
      </behavior> 
     </serviceBehaviors> 
     </behaviors> 

     <bindings> 
      <basicHttpBinding> 
       <binding name="BasicHttpBinding_Configuration" closeTimeout="00:01:00" 
        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
        allowCookies="false" bypassProxyOnLocal="false" maxBufferPoolSize="1073741824" 
        maxReceivedMessageSize="1073741824" useDefaultWebProxy="true"> 
        <readerQuotas maxDepth="1073741824" maxStringContentLength="1073741824" 
         maxArrayLength="1073741824" maxBytesPerRead="1073741824" maxNameTableCharCount="1073741824" /> 
       </binding> 
      </basicHttpBinding> 
     </bindings> 
     <client> 
      <endpoint address="http://server01-dev/WebServices/MasterEngine/MasterEngineService.svc" 
       binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Configuration" 
       contract="MasterEngineFarEnd.IMasterEngineService" name="BasicHttpBinding_IMasterEngineService" /> 
     </client> 
    </system.serviceModel> 
</configuration> 

내가 갔을 작동합니까

WPF 응용 프로그램이 오류가 실제로 상태 것과 함께했다,하지만 난 경우에도이 시점에서 8192을 아무 곳을 볼 수 없었다 적용되는 내용 또는 참조 할 수있는 내용 누군가가 올바른 방향으로 나를 가리킬 수 있다면 정말 감사 할 것입니다. UPDATE

<system.serviceModel> 

    <behaviors> 
    <endpointBehaviors> 
     <behavior> 
     <dataContractSerializer maxItemsInObjectGraph="2147483647" /> 
     </behavior> 
    </endpointBehaviors> 
    </behaviors> 


<endpoint address="http://server1/WebServices/MasterEngine/MasterEngineService.svc?wsdl" 
       binding="basicHttpBinding" 
       bindingConfiguration="BasicHttpBinding_Configuration" 
       contract="MasterEngineFarEnd.IMasterEngineService" 
       name="BasicHttpBinding_IMasterEngineService"/> 

- 필요한 경우, 그것은 DataMembers와 .. 이런 모습을 언급하고 내 수업/DataContracts는

이메일 PO 클래스

[DataContract] 
    public class EmailPO 
    { 
     [DataMember] 
     public string FromEmail { get; set; } 

     [DataMember] 
     public List<String> ToEmail { get; set; } 

     [DataMember] 
     public List<String> CcEmail { get; set; } 

     [DataMember] 
     public string FullHTML { get; set; } 

     [DataMember] 
     public string Subject { get; set; } 

     [DataMember] 
     public List<EmailClassLibrary.AttachmentItem> Attachments { get; set; } 

     [DataMember] 
     public string TableHeader { get; set; } 


    } 

편집을 설정 또한 이름을 지정하고 behaviorConfiguration에 동일한 이름을 사용하도록 끝점을 업데이트하여 시도했습니다.

답변

0

우리 객체의 직렬화 그래프가 기본 최대 한계를 초과하는 문제. 그래서 서비스 설정에서이 줄을 추가하십시오.

<system.serviceModel> 
    ... 
    <behaviors> 
     <endpointBehaviors> 
     <behavior name="Behaviors.EndpointBehavior"> 
      <dataContractSerializer maxItemsInObjectGraph="2147483647" /> 
     </behavior> 
     </endpointBehaviors> 
    </behaviors> 
    ... 
    </system.serviceModel> 

WCF 서비스 구성에서 작동합니다.

편집 : 당신이 문제가 해결되지 않은이 링크 CLICK here

+0

이 참조 할 수 있습니다.위의 편집을 참조하십시오. 같은 오류가 표시되었습니다. – gcoleman0828

관련 문제