I have a WCF service that is used to generate reports. That part works fine, but we need to archive the reports after being converted to PDF and that means sending the PDF to another WCF service.
Occasionally I get this error: "The remote server returned an unexpected response: (400) Bad Request."
I suspect that perhaps the data being sent to the service is too big. In this case, I'm sending an object that represents a file. It contains a property which is a byte array (and in this case it is 147800 bytes) and a few other properties (such as file
name).
I am using the WCF test client to test this. We also have a web application that's requesting the report with the same parameters and it is failing too, so I am pretty sure it isn't anything with the WCF Test Client configuration.
I can create the client for the second service, and when I call the method the exception occurs:
using (DocumentStorageServiceClient client = new DocumentStorageServiceClient())
{
long documentID = client.StoreReportDocument(document); // exception occurs here
}
I have tried tweaking the configuration for both the client settings on the first service and the service settings on the second service. Both services are behind a firewall so I don't think any security settings are coming into play here.
I had wanted to limit the request size to 10 MB but we may need to raise that at some point.
Here are the configuration settings for the first (reporting) service (which works fine):
If there are any typos in the endpoint addresses or contract names, it's probaby because I removed our real values from for this post.
I notice that there is no binding configuration on the second (document storage) service's web.config for the service itself. I assume it's using the defaults. I had added a binding configuration and adjusted some of the values but that isn't working.
I have also tried adjusting the httpRuntime's maxRequestSize and that didn't make a difference either.
At this point, I am not sure if I am looking in the right place. I need to get this resolved ASAP as I have a dealine to meet. Please help.
desertfoxaz
Member
307 Points
358 Posts
The remote server returned an unexpected response: (400) Bad Request.
Apr 06, 2012 03:53 PM|LINK
I have a WCF service that is used to generate reports. That part works fine, but we need to archive the reports after being converted to PDF and that means sending the PDF to another WCF service.
Occasionally I get this error: "The remote server returned an unexpected response: (400) Bad Request."
I suspect that perhaps the data being sent to the service is too big. In this case, I'm sending an object that represents a file. It contains a property which is a byte array (and in this case it is 147800 bytes) and a few other properties (such as file name).
I am using the WCF test client to test this. We also have a web application that's requesting the report with the same parameters and it is failing too, so I am pretty sure it isn't anything with the WCF Test Client configuration.
I can create the client for the second service, and when I call the method the exception occurs:
using (DocumentStorageServiceClient client = new DocumentStorageServiceClient()) { long documentID = client.StoreReportDocument(document); // exception occurs here }I have tried tweaking the configuration for both the client settings on the first service and the service settings on the second service. Both services are behind a firewall so I don't think any security settings are coming into play here.
I had wanted to limit the request size to 10 MB but we may need to raise that at some point.
Here are the configuration settings for the first (reporting) service (which works fine):
Here are the configuration settings for the second service. The breakpoint I set at the method on the service side is never hit.
If there are any typos in the endpoint addresses or contract names, it's probaby because I removed our real values from for this post.
I notice that there is no binding configuration on the second (document storage) service's web.config for the service itself. I assume it's using the defaults. I had added a binding configuration and adjusted some of the values but that isn't working. I have also tried adjusting the httpRuntime's maxRequestSize and that didn't make a difference either.
At this point, I am not sure if I am looking in the right place. I need to get this resolved ASAP as I have a dealine to meet. Please help.