Silverlight and error HTTP/1.1 504

Damir Dobric Posts

Next talks:

 

    

Follow me on Twitter: #ddobric



 

 

Archives

When working with WCF in SIlverlight sometimes you  might get following error:

The remote server returned an error: NotFound.

 

at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)

After digging in Fiddler you will find following:

HTTP/1.1 504 Fiddler - Receive Failure
Content-Type: text/html
Connection: close
Timestamp: 11:16:16:9903

ReadResponse() failed: The server did not return a response for this request.   


Assuming that you like me do not have any glue about the problem, here is a short explanation.
If There is an enum in your service contract which looks like: following sample, the error will appear..

[DataContract(Namespace=Constants.EntityNamespace)]
   public enum TagStatus
   {
       [EnumMember]
       Active = 1,

       [EnumMember]
       Paused = 2
   }

Believe or not, the problem is that the enum has to start with zero like shown below:

[DataContract(Namespace=Constants.EntityNamespace)]
   public enum TagStatus
   {
       [EnumMember]
       Active = 0,

       [EnumMember]
       Paused = 1
   }


Posted May 24 2010, 02:55 PM by Damir Dobric
Filed under:
developers.de is a .Net Community Blog powered by daenet GmbH.