Friday, February 18, 2011

WCF REST Internal Microsoft HttpWebResponse validation rules

The posting WCF REST Exception handling deals with handling ProtocolExceptions thrown by Microsoft's WCF REST implementation. This specific ProtocolException/Exception is thrown based on rules located in various methods in the following classes/methods in the .NET framework.

private bool CompleteGetResponse(IAsyncResult result);
 
Declaring Type: System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest 
Assembly: System.ServiceModel, Version=4.0.0.0 

 
public Message WaitForReply(TimeSpan timeout);
 
Declaring Type: System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest 
Assembly: System.ServiceModel, Version=4.0.0.0 
Then you can trace the code into the various static utility methods such as

Declaring Type: System.ServiceModel.Channels.HttpChannelUtilities 
Assembly: System.ServiceModel, Version=4.0.0.0 


public static HttpWebResponse ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason);
 
public static HttpInput ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding);

public static Exception CreateNullReferenceResponseException(NullReferenceException nullReferenceException);
Post a Comment