I googled quite a lot about this issue. Got many a solutions but none worked for me. I trying to upload an image file using WCF service. Small images get uploaded fine but once the size increase it gives out errors. Here is the error i'm getting
the remote server returned an unexpected response: (413) request entity too large
and here is my web.config(i believe its something to do with the web.config)
Service contract :
[OperationContract]
[WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
ResponseBase SaveAlertSettings(AlertSettingInfo alertSettingInfo);
AlertSettingInfo.fileToUpload has base64string which is first converted to stream and then written to server as an image file. It works fine for small size image file. Throws error for larger file like 4 mb images files.
Talk1:
Can you show us your service contract?
Talk2:
updated
Talk3:
Thanks. So, SaveAlertSettings() uploads images? Maybe show us AlertSettingInfo too please if so
Talk4:
updated
Solutions1
Binding must be added for webHttpBinding
Talk1:
Limits must be added to both service and client configurations. If your service isn't configured to handle large size or if you don't have control over it then you can't do anything about it. stackoverflow.com/questions/16265725/…