Sending xConnect requests might fail with an unhandled exception when the request size exceeds the value of the maxRequestLength attribute in the Web.config file. For example, if a visitor has visited too many pages, triggered too many goals, and a huge visit record is submitted to xConnect. The following message can be found in the log records:
[Error] XConnect Exception Logger LogAsync() Microsoft.OData.ODataException: The maximum number of bytes allowed to be read from the stream has been exceeded. After the last read operation, a total of 1055995 bytes has been read from the stream; however a maximum of 1048576 bytes is allowed. at Microsoft.OData.MessageStreamWrapper.MessageStreamWrappingStream.IncreaseTotalBytesRead(Int32 bytesRead) at Microsoft.OData.MessageStreamWrapper.MessageStreamWrappingStream.Read(Byte[] buffer, Int32 offset, Int32 count) ...
To resolve this issue, consider the following workaround:
<system.web>to
<compilation debug="true" targetFramework="4.7.1" />
<httpRuntime targetFramework="4.7.1" maxRequestLength="1048576" maxUrlLength="8192" maxQueryStringLength="8192" requestPathInvalidCharacters="" />
<customErrors mode="RemoteOnly" />
</system.web>
<system.web>
<compilation debug="true" targetFramework="4.7.1" />
<httpRuntime targetFramework="4.7.1" maxRequestLength="2147483647" maxUrlLength="8192" maxQueryStringLength="8192" requestPathInvalidCharacters="" />
<customErrors mode="RemoteOnly" />
</system.web>