What Was I Thinking?

Follies & Foils of .NET Development
posts - 95 , comments - 352 , trackbacks - 0


Solved: Unit/Integration Testing of a WCF Service
I've got a solution to running and debugging unit tests for WCF hosted services that utilize the CMServiceHost. Whether your generate your serivce proxy via WSDL (Add Service Reference) or Shared Contract (ClientFactory), the solution is similar. This email will detail how to invoke a WCF Service Host for testing in both scenarios. Testing a service client generated via "Add Service Reference" I'll illustrate the solution using the following sample unit test. Let's assume you've created a service ......

Posted On Thursday, September 16, 2010 8:06 AM | Comments (0) | Filed Under [ Visual Studio WCF ]

Supporting Request Timeout with a WebClient
I recently needed to adjust the timeout value of the HTTP Request being generated by WebClient. My attempt to perform a POST of a large file over HTTP was causing the WebClient to timeout. I thought adjusting the timeout value for the web client would fix this problem. One problem, the WebClient doesn’t support a Timeout value. I did some snooping via Reflector and discovered 2 important facts about the WebClient. Fact #1, The WebClient isn’t sealed. This means we can inherit from it. Fact #2: The ......

Posted On Tuesday, September 14, 2010 12:52 PM | Comments (8) | Filed Under [ Visual Studio WCF ]

Solving “XmlSchemaException: The global element '<elementName>' has already been declared.”
I recently encountered this error when I attempted to consume a new hosted WCF service. The service used the Request/Response model and had been properly decorated. The response and request objects were marked as DataContracts and had a specified namespace. My WCF service interface was marked as a ServiceContract and shared the namespace attribute value. Everything should have been fine, right? [ServiceContract(Namespace = "http://schemas.myclient.co... public interface IProductActivationService ......

Posted On Wednesday, April 14, 2010 10:01 AM | Comments (7) | Filed Under [ Visual Studio WCF ]

Powered by: