Basically, I created one page into HTML then i want to send two files XML & SVG. Both files are converted to text and then send to the WCF service in the MVC project. but it gives "Error: 413 “Request Entity Too Large”. I tried a small file & its works. but more than 200kb is not working well. i tried to convert stream, but I had no luck. so I decided to convert it into string & pass it.
My HTML Page -
My WCF code -
also, i checked online solution for that but its already done.
ERROR -
If anyone knows, how to convert string to Stream in javascript, then tell me. I am able to accept stream value.
CodePudding user response:
You can set the Maximum limit for receiving files in WCF like this:
WebServiceHost webServiceHost = new WebServiceHost(typeof(UploadService), uri);
WebHttpBinding binding = new WebHttpBinding();
binding.MaxReceivedMessageSize = Int32.MaxValue;
webServiceHost.AddServiceEndpoint(typeof(IUploadService), binding, "WebServiceHost");
webServiceHost.Open();
And you can try setting the upload size limit in HTML web.config.
CodePudding user response:
I found the solution after spending 1-2 days. look into this url
https://cmatskas.com/upload-files-in-asp-net-mvc-with-javascript-and-c/