Silverlight Web Services Team Blog

For those interested in WCF development on Silverlight, the Silverlight Web Services team just set up a team blog.


Custom transport channels and BindingElements

When creating a custom transport channel, you must be sure to remove the encoding binding element from the binding context before returning from your BuildChannelFactory and BuildChannelListener calls. The best place to do this is within the constructor for your transport channel factory or listener.MessageEncodingBindingElement encodingBindingElement = context.BindingParameters.Remove<MessageEncodingBindingElement>(); Its needs to be removed because there is a validation…


Custom UserNamePassword Validators in .Net Framework 3.5

In the version of WCF that shipped with .Net Framework 3.0 we didn’t support custom validators with transport level HTTP security. We received much feedback from the community that this was a highly desired feature, so I’m happy to say we added support for this scenario in the 3.5 release of the .Net Framework. Note…


Client IP addresses in Orcas

As Nicholas promised, here is some more information about client IP address in Orcas. In the Orcas release of WCF, we added the ability for services to get the IP address and port of the calling client from your service methods when the underlying transport is Http or Tcp. You can access the address and port…


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;


Securing WCF to only respond to local requests.

Is it possible to secure a web service to only respond to local requests over HTTP? Yes, you just need to make sure that you listen at with HostNameComparisonMode = Exact.ServiceHost service = new ServiceHost(typeof(MyService), new Uri(“”)); BasicHttpBinding binding = new BasicHttpBinding(); binding.HostNameComparisonMode = HostNameComparisonMode.Exact; service.AddServiceEndpoint(typeof(IMyService), binding , “BasicEndpoint”); Also, be sure to run…


Changing BindingElement settings on a Binding.

We don’t allow you to modify the properties of the binding directly, but you can create a copy of the binding elements used to create a particular binding, alter the desired properties, then use the binding element collection to create a new custom binding.  BasicHttpBinding basicBinding = new BasicHttpBinding(); BindingElementCollection bindingElementCollection = basicBinding.CreateBindingElements(); bindingElementCollection.Find<HttpTransportBindingElement>().KeepAliveEnabled =…