0

I have a web project deployed to an Azure Worker role. I have created a web.config with binding redirects, and also a config file for the compiled code in the format My.ProjectName.dll.config - this is following advice here: Assembly binding redirect not working

I am using Azure SDK 1.7.

The issue is that despite having the correct binding redirect in both config files (this approach works on multiple other worker roles) I repeated see that the worker role recycles on deployment because of an issue.

Checking the event logs shows this is a binding redirect issue with Castle.Windsor:

WaIISHost
Role entrypoint could not be created: System.TypeLoadException: Unable to load the role entry point due to the following exceptions:
-- System.IO.FileLoadException: Could not load file or assembly 'Castle.Windsor, Version=3.2.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'Castle.Windsor, Version=3.2.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc'

I have enabled fusion logging to get additional detail, and I can see that the role entry point loads:

  • F:\base\x64\WallSHost.exe.config
  • Machine.config

I don't want to put the binding redirect in there because I have no control over those files as part of the deployment process.

I am sure I am missing something simple here - any suggestions as to what I might be missing?

For reference, my binding redirect contains the following (in both config files):

 <dependentAssembly>
        <assemblyIdentity name="Castle.Windsor" publicKeyToken="407dd0808d44fbdc" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.3.0.0" newVersion="3.3.0.0" />
      </dependentAssembly>

The actual version of Castle.Windsor used is 3.3.0.43.

Community
  • 1
  • 1
darth_phoenixx
  • 932
  • 12
  • 23

1 Answers1

-2

So after further investigation it turns out that we had three versions of Castle.Windsor installed in various projects within the solution:

  • 3.2.0
  • 3.2.1
  • 3.3.0

One of our external packages had a dependency on a specific version of Castle.

Once the versions were aligned across all projects in the solution this issue went away - I still needed to have the correct binding redirect in My.ProjectName.dll

darth_phoenixx
  • 932
  • 12
  • 23