Friday, March 13, 2009

how to get the size of a byte array in C#

System.IO.MemoryStream stream = new System.IO.MemoryStream();

System.Runtime.Serialization.Formatters.Binary.BinaryFormatter objFormatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
objFormatter.Serialize(stream, byData);
long size = stream.Length;

Friday, March 06, 2009

The remote server returned an error: NotFound WCF

This is a very common error message. To solve this, first you need to enable loggin in WCF. (Search for WCF Logging on Google) . Make you in logging section you enable all the types of the error messages

Eg


logMessagesAtServiceLevel="false" logMessagesAtTransportLevel="false"
maxSizeOfMessageToLog="2147483647" />


then you can see the exception on the error log file..


I got this error message because i have not set max request length, you need to add this to the web.config file

Wednesday, March 04, 2009

400 - Bad Request response

I was getting this message on the newly created silverlight app and it was driving me crazy.

this is how to fix it

in the ServiceReferences.ClientConfig


and in the Web Site project. Web.config file




maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">






bindingConfiguration="MyBinding" contract="TranscriptViewerWebApp.IRFTranscriptService">