I can send an Image byte array that is less than 16 KB to my WCF Service. If I send anything bigger than that I get the following error:
An exception of type 'System.ServiceModel.ProtocolException' occurred in System.ServiceModel.dll but was not handled in user code
Additional information: The remote server returned an unexpected response: (404) Not Found.
This error makes no sense as the only thing that I changed was the image. I have tested this with other files and receive the same thing. I have also set the Max Buffer size to 20000000. Anyone know what the problem could be?
I have not set the max received message on the WCF Service Web.Config file. Do I need to change that? This is only a guess as the error message makes no sense.
Here's some code:
// WCF
System.ServiceModel.BasicHttpBinding Binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
Binding.MaxBufferSize = 200000000;
Binding.MaxReceivedMessageSize = 200000000;
EndpointAddress Address = new EndpointAddress("http://localhost/WCFService/Designer.svc");
public DesignerServiceReference.DesignerClient DesignerClient = null;
DesignerClient = new DesignerServiceReference.DesignerClient(Binding, Address);
// Upload an Image to the WCF Service
private void AddImageUserControl_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
// Send
Stream Stream = (System.IO.Stream)ImageAdd.OpenFileDialog.SelectedFile.OpenRead();
byte[] Buffer = new byte[Stream.Length];
Stream.Read(Buffer, 0, (int)Stream.Length);
Stream.Dispose();
Stream.Close();
DesignerClient.SaveImageAsync(Buffer);
DesignerClient.SaveImageCompleted += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(SaveImage_Completed);
}
The error occurs on the following line and the service code never gets executed:
public void EndSaveImage(System.IAsyncResult result) {
object[] _args = new object[0];
base.EndInvoke("SaveImage", _args, result);
}
Thanks,
brad