sto ricevendo il seguente errore in una chiamata WCF:WCF errore "Il numero massimo di elementi che possono essere serializzati o deserializzati in un oggetto grafico è '65536'"
Il numero massimo di elementi che possono essere serializzato o deserializzato in un oggetto grafico è '65536'
ho letto un sacco di post del forum e molti di loro citare la modifica del app.config e web.config per specificare nuovo comportamento per consentire grafi di oggetti più grandi. Ho fatto che, e questo è quello che ho in questi file:
App.config al progetto WPF:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="">
<dataContractSerializer maxItemsInObjectGraph="2147483646"/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="digiPM.Shell.LogOutPMSEMRService.PMSEMRLogOutService">
<!--<endpoint address="" binding="basicHttpBinding" contract="digiPM.Shell.LogOutPMSEMRService.IPMSEMRLogOutService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/digiPM.Shell.LogOutPMSEMRService/PMSEMRLogOutService/" />
</baseAddresses>
</host>-->
<endpoint address="" binding="netTcpBinding" name="NetTcpBindingEndpoint" contract="digiPM.Shell.LogOutPMSEMRService.IPMSEMRLogOutService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" name="MexTcpBidingEndpoint" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8732/Design_Time_Addresses/digiPM.Shell.LogOutPMSEMRService/PMSEMRLogOutService/" />
</baseAddresses>
</host>
</service>
</services>
<!--binding info - removed this for the sake of readability for this post -->
web.config sul progetto di servizio:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_Services" closeTimeout="01:10:00" openTimeout="01:10:00" receiveTimeout="01:10:00" sendTimeout="01:10:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
messageEncoding="Mtom" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="4096" maxStringContentLength="2147483647" maxArrayLength="524288" maxBytesPerRead="524288" maxNameTableCharCount="524288" />
<reliableSession ordered="true" inactivityTimeout="01:10:00" enabled="false" />
<security mode="None">
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="digiPM.Service.Behavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="customObjectQuota">
<dataContractSerializer maxItemsInObjectGraph="2147483646"/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="digiPM.Service.Behavior"
name="digiPM.Service.AddressCrudService">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_Services"
name="AddressCrudServiceEndPoint" bindingNamespace="urn:Dawliasoft.Sculpture" contract="digiPM.Services.Contracts.IAddressCrudService" behaviorConfiguration="customObjectQuota" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" behaviorConfiguration="customObjectQuota" />
</service>
<!--<more services defined with same configuration as above..>-->
</services>
</system.serviceModel>
Questo, tuttavia, non ha aiutato. Si noti che i servizi a cui si fa riferimento in APP.CONFIG non sono i servizi con cui ho problemi.
Ho anche provato la seguente:
aggiunto questi attributi per l'implementazione del servizio: [DataContract (IsReference = true)], [ServiceBehavior (AddressFilterMode = AddressFilterMode.Any, MaxItemsInObjectGraph = 2147483646)]
ha scritto una classe DataContractSerializerOperationBehavior personalizzata che imposta il comportamento MaximumObjectsInGraph e IsReference. Aggiunto anche Attributo personalizzato per applicare questo le implementazioni del servizio. Per motivi di ingombro, non ho inserito il codice, ma posso aggiungerlo se qualcuno pensa che sarebbe utile.
Pensieri? Idee? Dove vado da qui?
Grazie in anticipo!
ho aggiunto altro da sezioni del modello system.service da entrambi i file di configurazione – Scot
aha! ... penso che tu potrebbe essere su qualcosa ... Controllerò di aggiungere la sezione "Client". Cordiali saluti - questo è un progetto che ho ereditato da un altro team, non ho idea del metodo che hanno usato per generare il file app.config per l'app WPF. – Scot
Prova ad aggiungere un "Servizio di riferimento" in Visual Studio e non dimenticare di cancellare l'intera sezione "system.servicemodel" nel tuo app.config prima di aggiungere il riferimento al servizio ... la tua vita sarà molto più facile ... e quindi puoi personalizzare il tuo file di configurazione aggiungendo la roba 'maxItemsInObjectGraph' ... buona fortuna. – Nabheet