I am getting WCF service exception when I am trying to add huge data to report parameter, if we send small chunk of data its working fine. do verify my code and suggest me the right way to add parameter data. Added web.config setting along with the reportviewer code.
<
bindings
>
<
customBinding
>
<
binding
name
=
"BinaryHttpBinding"
>
<
binaryMessageEncoding
>
<
readerQuotas
maxDepth
=
"32"
maxStringContentLength
=
"2147483647"
maxArrayLength
=
"2147483647"
maxBytesPerRead
=
"2147483647"
maxNameTableCharCount
=
"16384"
/>
</
binaryMessageEncoding
>
<
httpTransport
maxReceivedMessageSize
=
"2147483647"
maxBufferSize
=
"2147483647"
/>
</
binding
>
</
customBinding
>
</
bindings
>
public
partial
class
ReportViewer : Page, IReportServiceClientFactory
{
public
ReportSettingsDTO ReportParametersObject {
get
;
set
; }
public
ReportViewer()
{
InitializeComponent();
this
.rptViewer.ReportServiceClientFactory =
this
;
this
.rptViewer.Report =
"WebClient.Reports.TestReport, WebClient"
;
this
.rptViewer.RenderBegin +=
new
RenderBeginEventHandler(rptViewer_RenderBegin);
}
void
rptViewer_RenderBegin(
object
sender, RenderBeginEventArgs args)
{
args.ParameterValues[
"ParameterObject"
] = serialize();
}
public
string
serialize()
{
MemoryStream ms =
new
MemoryStream();
// Serializer the User object to the stream.
DataContractSerializer ser =
new
DataContractSerializer(
typeof
(ReportSettingsDTO));
ser.WriteObject(ms, ReportParametersObject);
byte
[] array = ms.ToArray();
ms.Close();
return
Encoding.UTF8.GetString(array, 0, array.Length);
}
#region IReportServiceClientFactory Members
ReportServiceClient IReportServiceClientFactory.Create(System.Uri remoteAddress)
{
var binding =
new
BasicHttpBinding()
{
TransferMode = System.ServiceModel.TransferMode.Buffered,
MaxBufferSize =
int
.MaxValue,
MaxReceivedMessageSize =
int
.MaxValue,
OpenTimeout =
new
TimeSpan(0, 15, 0),
ReceiveTimeout =
new
TimeSpan(0, 15, 0),
SendTimeout =
new
TimeSpan(0, 15, 0)
};
var endpointAddress =
new
EndpointAddress(remoteAddress);
return
new
ReportServiceClient(binding, endpointAddress);
}
#endregion
}