How can I use WCF with the basichttpbinding only , SSL and Basic Authentication in IIS?

After some digging and asking some questions to a few colleagues, we finally solved the problem. Important to understand is there are 2 aspects of security in this case. The IIS security and the WCF security. IIS security: Enable SSL & enable Basic Authentication. Disable Anonymous Authentication. (Of course, create a windows account/group and set … Read more

WCF GZip Compression Request/Response Processing

Thanks for your WCF tip! We’re going to be enabling IIS compression for services at my shop, and I’m hoping your solution will work. By “To make this work for Web Services” – did you mean old school SoapHttpProtocol clients? Because the SoapHttpProtocol class has a built-in EnableDecompression property, which will automatically handle the Compression … Read more

How do I tell WCF to skip verification of the certificate?

You might be able to achieve this in Silverlight by allowing cross-domain communication between the web server the hosts the Silverlight application and the remote WCF service. In that case you need to place a clientaccesspolicy.xml file at the root of the domain where the WCF service is hosted: <?xml version=”1.0″ encoding=”utf-8″?> <access-policy> <cross-domain-access> <policy> … Read more

access HttpContext.Current from WCF Web Service

You can get access to HttpContext.Current by enabling AspNetCompatibility, preferably via configuration: <configuration> <system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled=”true”/> </system.serviceModel> </configuration> That in turn allows you to get access to the current user: HttpContext.Current.User – which is what you’re after, right? You can even enforce AspNetCompatibility by decorating your service class with an additional attribute: [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)] … Read more

what is the global.asax Application_Start equivalent when using WAS in IIS7

I believe AppInitialize() is the method you’re looking for. Here’s an article on using it to initialise Castle Windsor in a WAS hosted WCF service: Castle Windsor and non-HTTP Protocol WCF Services The essence of the article is, instead of using Application_Start() which won’t get called in WAS: protected void Application_Start(object sender, EventArgs e) { … Read more

IsReference property in data contract

It determines how objects are serialized, by default, IsReference=false. Setting IsReference = true allows the serialization of trees of objects that can reference each other. So with a list of Employees that each have a property for Manager (who is also an Employee), a reference to the Manager for each Employee can be held rather … Read more

Why is my WCF web service presenting this object in a different namespace with different field names?

It is stunning how many hours I’ve spent on this, how many solutions I’ve tried, how many links I’ve followed, and how many SO answers I’ve read that did not answer my question before finally finding that the answer was sitting right here on SO for more than 2 years! The root problem is that … Read more