Missing or Malformed Service Bindings Can Hose ALL Your Service Calls

I learned something interesting yesterday. After we did a new production deployment at work for one of our websites, we ran into a few issues that hadn't occurred in QA or staging. The first was that, for some reason, calls from the website (which is an ASP.NET MVC 4.5 site) to one of our WCF services, was failing. The service in question is used to retrieve images from Sharepoint. Later, we found another issue, wherein attempts to contact a different service for the purposes of sending email were failing. As it turned out, the two issues, while seemingly unrelated, were caused by the exact same problem.

In addition to the endpoints for the two aforementioned services, our Web.config file also contained an endpoint for a third service, that is not yet in use, but is defined and in development. But somehow, the binding for this service didn't make it into the production version of the Web.config file, and therefore when the app tried to make use of any service, an exception was occurring and, the service call, whatever it was and to whichever service, wasn't being executed.

Even though I've been using WCF services for years, I was not aware until yesterday that a missing or malformed binding could stop all service calls from being executed (I mention malformed bindings because our first attempt to add the missing binding was entered incorrectly and was not valid, leading to the same result as if it wasn't there at all). This was not an intuitive fix to the two problems that we thought were unrelated, and we were lucky to have found the solution in a relatively short amount of time.


Popular Posts

How To Mock Out Child Components In Unit Tests of Angular 2 Code

A Generic Method Using HttpClient to Make a Synchronous Get Request

The Cause and Solution for the "System.Runtime.Serialization.InvalidDataContractException: Type 'System.Threading.Tasks.Task`1[YourTypeHere]' cannot be serialized." Exception

A Red Herring When Using Moq to Mock Methods With Optional Parameters

Unit Testing with a Mock Entity Framework DbContext and Fake DbSets