我有一个非常讨厌的问题,我的WCF服务对大多数请求都很好,但对于特定的大型请求,我在标题中收到此错误:
HTTP / 1.1 413请求实体太大
请求是在我指定的最大请求长度(2147483647)下,所以我不知道为什么会发生这种情况。
这些是我添加到配置文件中的设置,以克服这个问题,但没有任何工作:
<httpRuntime maxRequestLength="2147483647" />
<behavior>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
<basicHttpBinding>
<binding name="secureHttpBinding"
maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647"
maxBufferSize="2147483647"
transferMode="Streamed">
<readerQuotas
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxDepth="64"
maxNameTableCharCount="2147483647"/>
</binding>
</basicHttpBinding>
我还在下面包含了整个配置文件。任何人都可以帮我理解这里出了什么问题吗?
我无法访问实时发送这些消息的客户端,但我正在使用Soap UI进行测试。
谢谢
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="AccessConnectionString" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Bassie\Desktop\Biz Backoffice.mdb" />
<add name="LogPath" connectionString="C:\Test\pnp\pnp.log" />
<add name="ErrorPath" connectionString="C:\Test\pnp\errors" />
</connectionStrings>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" maxRequestLength="2147483647" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="debug">
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="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>
<services>
<service name="WCFService1.Service1">
<endpoint address="http://Biz.ddns.net/Service1.svc"
binding="basicHttpBinding"
bindingConfiguration="secureHttpBinding"
contract="WCFService1.IService1"
/>
<!--<endpoint address="mex" binding="mexHttpsBinding"
contract="IMetadataExchange" />-->
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="secureHttpBinding"
maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647"
maxBufferSize="2147483647"
transferMode="Streamed">
<readerQuotas
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxDepth="64"
maxNameTableCharCount="2147483647"/>
<security mode="Transport">
<transport clientCredentialType="Basic" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true" />
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
这是一个示例消息(当然是在发送时包装在Soap信封中)。您会注意到只有2 receivingAdviceItemContainmentLineItem
个元素,但是给我问题的消息包含大约50个。请注意,保存到文件时,完整的消息大小约为128kb:
<sh:StandardBusinessDocument
xmlns:sh="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader"
xmlns:deliver="urn:ean.ucc:deliver:2"
xmlns:eanucc="urn:ean.ucc:2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<sh:StandardBusinessDocumentHeader>
<sh:HeaderVersion>1.0</sh:HeaderVersion>
<sh:Sender>
<sh:Identifier Authority="EAN.UCC">6001000000001</sh:Identifier>
</sh:Sender>
<sh:Receiver>
<sh:Identifier Authority="EAN.UCC">6001007805159</sh:Identifier>
</sh:Receiver>
<sh:DocumentIdentification>
<sh:Standard>EAN.UCC</sh:Standard>
<sh:TypeVersion>2.5</sh:TypeVersion>
<sh:InstanceIdentifier>0000000643343333</sh:InstanceIdentifier>
<sh:Type>ReceivingAdvice</sh:Type>
<sh:MultipleType>false</sh:MultipleType>
<sh:CreationDateAndTime>2017-06-22T00:00:00</sh:CreationDateAndTime>
</sh:DocumentIdentification>
</sh:StandardBusinessDocumentHeader>
<eanucc:message>
<entityIdentification>
<uniqueCreatorIdentification>G_REC_5005721318</uniqueCreatorIdentification>
<contentOwner>
<gln>6001000000001</gln>
</contentOwner>
</entityIdentification>
<eanucc:transaction>
<entityIdentification>
<uniqueCreatorIdentification>G_REC_5005721318</uniqueCreatorIdentification>
<contentOwner>
<gln>6001000000001</gln>
</contentOwner>
</entityIdentification>
<command>
<eanucc:documentCommand>
<documentCommandHeader type="ADD">
<entityIdentification>
<uniqueCreatorIdentification />
<contentOwner>
<gln>6001000000001</gln>
</contentOwner>
</entityIdentification>
</documentCommandHeader>
<documentCommandOperand>
<deliver:receivingAdvice creationDateTime="2017-06-22T00:00:00" documentStatus="ORIGINAL">
<documentStructureVersion>
<versionIdentification>2.5</versionIdentification>
</documentStructureVersion>
<reportingCode>CONFIRMATION</reportingCode>
<receivingAdviceIdentification>
<uniqueCreatorIdentification>G_REC_5005721318</uniqueCreatorIdentification>
<contentOwner>
<gln>6001000000001</gln>
</contentOwner>
</receivingAdviceIdentification>
<shipTo>
<gln>6001007022334</gln>
<additionalPartyIdentification>
<additionalPartyIdentificationValue>MA08</additionalPartyIdentificationValue>
<additionalPartyIdentificationType>BUYER_ASSIGNED_IDENTIFIER_FOR_A_PARTY</additionalPartyIdentificationType>
</additionalPartyIdentification>
</shipTo>
<shipper>
<gln>6001007805159</gln>
</shipper>
<receiver>
<gln>6001007022334</gln>
</receiver>
<receivingAdviceItemContainmentLineItem number="0001">
<containedItemIdentification>
<gtin>16001000806532</gtin>
<additionalTradeItemIdentification>
<additionalTradeItemIdentificationValue>109395</additionalTradeItemIdentificationValue>
<additionalTradeItemIdentificationType>SUPPLIER_ASSIGNED</additionalTradeItemIdentificationType>
</additionalTradeItemIdentification>
<additionalTradeItemIdentification>
<additionalTradeItemIdentificationValue>client GEM SQUASH LS 1PK</additionalTradeItemIdentificationValue>
<additionalTradeItemIdentificationType>BUYER_ASSIGNED</additionalTradeItemIdentificationType>
</additionalTradeItemIdentification>
<additionalTradeItemIdentification>
<additionalTradeItemIdentificationValue>000000000000109395</additionalTradeItemIdentificationValue>
<additionalTradeItemIdentificationType>BUYER_ASSIGNED</additionalTradeItemIdentificationType>
</additionalTradeItemIdentification>
</containedItemIdentification>
<specification number="0">
<reference>
<referenceDateTime>0000-00-00T00:00:00.000</referenceDateTime>
<referenceIdentification>NFI72449</referenceIdentification>
</reference>
</specification>
<purchaseOrder>
<documentReference creationDateTime="0000-00-00T00:00:00.000">
<uniqueCreatorIdentification>4529222808</uniqueCreatorIdentification>
<contentOwner>
<gln>6001000000001</gln>
</contentOwner>
</documentReference>
</purchaseOrder>
<quantityAccepted>
<value>9.000</value>
<unitOfMeasure>
<measurementUnitCodeValue>CK2</measurementUnitCodeValue>
</unitOfMeasure>
</quantityAccepted>
<quantityReceived>
<value>9.000</value>
<unitOfMeasure>
<measurementUnitCodeValue>CK2</measurementUnitCodeValue>
</unitOfMeasure>
</quantityReceived>
<receivingConditionInformation>
<receivingCondition>GOOD_CONDITION</receivingCondition>
<receivingConditionQuantity>
<value>9</value>
</receivingConditionQuantity>
</receivingConditionInformation>
</receivingAdviceItemContainmentLineItem>
<receivingAdviceItemContainmentLineItem number="0002">
<containedItemIdentification>
<gtin>96001007182697</gtin>
<additionalTradeItemIdentification>
<additionalTradeItemIdentificationValue>392007</additionalTradeItemIdentificationValue>
<additionalTradeItemIdentificationType>SUPPLIER_ASSIGNED</additionalTradeItemIdentificationType>
</additionalTradeItemIdentification>
<additionalTradeItemIdentification>
<additionalTradeItemIdentificationValue>thirdparty PLASTIC CRATE</additionalTradeItemIdentificationValue>
<additionalTradeItemIdentificationType>BUYER_ASSIGNED</additionalTradeItemIdentificationType>
</additionalTradeItemIdentification>
<additionalTradeItemIdentification>
<additionalTradeItemIdentificationValue>000000000000392007</additionalTradeItemIdentificationValue>
<additionalTradeItemIdentificationType>BUYER_ASSIGNED</additionalTradeItemIdentificationType>
</additionalTradeItemIdentification>
</containedItemIdentification>
<specification number="0">
<reference>
<referenceDateTime>0000-00-00T00:00:00.000</referenceDateTime>
<referenceIdentification>NFI72449</referenceIdentification>
</reference>
</specification>
<purchaseOrder>
<documentReference creationDateTime="0000-00-00T00:00:00.000">
<uniqueCreatorIdentification>4529222808</uniqueCreatorIdentification>
<contentOwner>
<gln>6001000000001</gln>
</contentOwner>
</documentReference>
</purchaseOrder>
<quantityAccepted>
<value>9.000</value>
<unitOfMeasure>
<measurementUnitCodeValue>EA</measurementUnitCodeValue>
</unitOfMeasure>
</quantityAccepted>
<quantityReceived>
<value>9.000</value>
<unitOfMeasure>
<measurementUnitCodeValue>EA</measurementUnitCodeValue>
</unitOfMeasure>
</quantityReceived>
<receivingConditionInformation>
<receivingCondition>GOOD_CONDITION</receivingCondition>
<receivingConditionQuantity>
<value>9</value>
</receivingConditionQuantity>
</receivingConditionInformation>
</receivingAdviceItemContainmentLineItem>
<receiptInformation>
<receivingDateTime>2017-06-22T00:00:00</receivingDateTime>
</receiptInformation>
<consignmentIdentification>
<referenceDateTime>2017-06-22T00:00:00</referenceDateTime>
<referenceIdentification>NFI72449</referenceIdentification>
</consignmentIdentification>
</deliver:receivingAdvice>
</documentCommandOperand>
</eanucc:documentCommand>
</command>
</eanucc:transaction>
</eanucc:message>
</sh:StandardBusinessDocument>
答案 0 :(得分:0)
我更改了我的web.config
,使其看起来像这样:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="AccessConnectionString" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Bassie\Desktop\AllwaysFresh Backoffice.mdb" />
<add name="LogPath" connectionString="C:\Test\pnp\pnp.log" />
<add name="ErrorPath" connectionString="C:\Test\pnp\errors" />
</connectionStrings>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" maxRequestLength="2097151" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="debug">
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior>
<dataContractSerializer maxItemsInObjectGraph="2097151"/>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="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>
<services>
<service name="Service1">
<endpoint address=""
binding="basicHttpBinding"
contract="IService1"
/>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding maxBufferPoolSize="2097151"
maxReceivedMessageSize="2097151"
maxBufferSize="2097151"
transferMode="Streamed">
<readerQuotas
maxStringContentLength="2097151"
maxArrayLength="2097151"
maxBytesPerRead="2097151"
maxDepth="2097151"
maxNameTableCharCount="2097151"/>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483648" />
</requestFiltering>
</security>
<modules runAllManagedModulesForAllRequests="true" />
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true" />
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
它现在似乎有效......
我更改了配置文件的各个部分,其中没有一个看起来特别相关,所以不确定它为什么会起作用。如果有人能够对此有所了解那就太棒了。