共用方式為


Accessing the Http Query String from a service method.

I'm trying to access the query string used by the client when contacting my service. How can I do this?  

You can access the query string through the HttpRequestMessageProperty.

 OperationContext context = OperationContext.Current;
MessageProperties properties = context.IncomingMessageProperties;

HttpRequestMessageProperty requestProperty = properties[HttpRequestMessageProperty.Name] as HttpRequestMessageProperty;

string queryString = requestProperty.QueryString;