We’ve recently adopted the excellent S#arp Architecture for our projects. I highly recommend taking a look at the project site.

On Friday I created a simple WCF service using S#arp’s Northwind sample site for  reference.

Using WcfTestClient I located my service and attempted to test one of the methods, only to get the following error.

Could not load file or assembly ‘Castle.Windsor, Version=1.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc’ or one of its dependencies. The system cannot find the file specified.

I looked for the usual suspects (rogue entries in the GAC, searching the c: drive for instances of Castle.Windsor) but couldn’t find the problem.

Eventually I discovered this code in the sample site’s web.config.

  1. <runtime>
  2.   <assemblyBinding xmlns=urn:schemas-microsoft-com:asm.v1>
  3.     <dependentAssembly>
  4.       <assemblyIdentity name=Castle.Windsor publicKeyToken=407dd0808d44fbdc culture=neutral/>
  5.       <bindingRedirect oldVersion=0.0.0.0-65535.65535.65535.65535 newVersion=2.0.0.0/>
  6.     </dependentAssembly>
  7.   </assemblyBinding>
  8. </runtime>

Copying this to the web.config for my WCF service solved the problem.

Stuck every time you jump out of the tutorials?

Make 2019 the year you finally conquer all those controllers, views, models and all that other "stuff" that comes with MVC.

You'll also get ASP.NET advice, guidance and useful tips from me once a week (or so). I respect your email privacy, unsubscribe at any time.

Stuck every time you jump out of the tutorials?

Stop wasting time trying to learn ASP.NET Core MVC and fast forward to the fun bit (building your features)

Can't make sense of front-end development?

Check out Front-end in four hours for a head-start

Take a look

Stuck every time you jump out of the tutorials?

Make 2019 the year you finally conquer all those controllers, views, models and all that other "stuff" that comes with MVC.

You'll also get ASP.NET advice, guidance and useful tips from me once a week (or so). I respect your email privacy, unsubscribe at any time.