I am always learning different parts of the C# language b/c lets face it, it's a lot of fun . I've decided to configure my wcf service as a rest service which supports json request/response instead of xml. All has gone well and I can serialize/deserialize my messages into complex classes so far, unless I send a bunch of data in them. I've tried to change my readerQuotas, etc, etc but everytime I try to make a call it says "Error: Bad Data". I know the service works because I can call simple functions and pass data to/from the service. But if I pass a class with 3 byte[] properties each 128 bytes in length it fails. If I pass the same class with each byte[] param with 3 bytes of data it goes through (I base64 encode each complex class after serializing them). Here is my example code:This example passes and goes through:

Not really strong with debugging other peoples code.. But.. have you tried:

1) Sending the same data but un-encrypted
2) Using AsciiEncoding.Ascii instead of Encoding.UTF8 for the base64 encode?
3) It looks like you are just using the CryptographicEngine, that won't base64 it, have you tried just a plain-jane base64 encode?
4) You pass in a few variables, are you sure they are all initialized correctly?

Well basically I'm just taking the json string (that was created by serializing the complex class) in TestFunc and base64 encoding it to send it across to the rest service so I don't have a long query string similar to /TestFunc/{[80,10,01,01,30,10,10], "test":"etc"}. So I am base64 encoding the whole thing then decoding it on the rest service side. If I send the class with only have small amounts of byte data it goes through just fine. If I send each byte[] with having 128 different indexes each then it fails. Ingramator which files do you want? The debugger just outputs saying "The remote server returned an error: (400) Bad Request."
System.Net.WebException was unhandled by user code
HResult=-2146233079
Message=The remote server returned an error: (400) Bad Request.
Source=System
StackTrace:
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at TestSaleStoreApp.TestSaleRestSvcClient.<TestFunc>d__a.MoveNext() in c:\Users\User\Documents\Visual Studio 2012\Projects\TestSaleStoreApp\TestSaleStoreApp\TestSaleRestSvcClient.cs:line 50
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at TestSaleStoreApp.MainUserPg.<initSettings>d__16.MoveNext() in c:\Users\User\Documents\Visual Studio 2012\Projects\TestSaleStoreApp\TestSaleStoreApp\MainUserPg.xaml.cs:line 524
InnerException:
If you need more info let me know I'm stumped on this one. As for the ASCII I haven't tried that yet I'll look into it later today but I'm suspecting it has to do with the length of the content (which I've changed the readerQuota settings).

Hmm it's always to debug without having it in front of you but I can try and point you in the right direction! If its working with smaller data samples it may be that you're [trying to encode an unsupported data type]/[base64 doesn't know what to encode so its sending invalid data] but I can't tell from the log there. The most common problem I find is that the data buffer is not being completely filled or filled correctly so I'd investigate that first! Enable tracing first, instructions here http://msdn.microsof...y/ms733025.aspx then test and it will show you exactly where the problem is occurring. Hope this helps, good luck with the project mate!

Writing the object to the body stream and changing the parameter type of the service to the complex object instead of a string made it work for some reason. REST is more of a pain learning how to use then SOAP that is for sure

So I want to take this time to thank everyone who helped me. You guys are all great assets to this community and I hope I can give back one day by finding other questions I can answer in this forum and post my 2 cents on the subject (you guys are just too quick it seems most of the time and say what I would say ). +1 to you all and I hope you have a good holiday.