How to solve this InvalidCastException while applying ClientCertificate to WCF DataService Client?
问题 I have used the examples in this article to add client certificate authentication to my WCF Data Service. I had to change the example slightly because I am using WCF DataService 5.6 in which the SendingRequest event has been deprecated and replaced by SendingRequest2 . Basically this meant changing the following event handler: private void OnSendingRequest_AddCertificate(object sender, SendingRequestEventArgs args) { if (null != ClientCertificate) { ((HttpWebRequest)args.Request)