rongriffin / MassTransit.Host.RabbitMQ

MassTransit host process for services using RabbitMQ
Apache License 2.0
6 stars 3 forks source link

Magnum dependency tied to 2.1.2.0 Specifically? #1

Closed SeanKilleen closed 9 years ago

SeanKilleen commented 9 years ago

Hi all,

New to this -- thanks for your hard work. Not sure if this issue is on my end or not.

I'm starting a new MassTransit project. I've added MassTransit and MassTransit.Host.RabbitMQ to the project.

The MassTransit.Host.RabbitMQ project on nuget appears to say that it requires >=2.1.2:

image

However, MassTransit 2.9.9 requires >= 2.1.3:

image

My assumption is that this should be fine, since The RabbitMQ host appears to accept greater than or equal to 2.1.2.x.

However, though the project builds fine, at runtime I receive the following error:

An exception of type 'System.IO.FileLoadException' occurred in MassTransit.Transports.RabbitMq.dll but was not handled in user code Additional information: Could not load file or assembly 'Magnum, Version=2.1.2.0, Culture=neutral, PublicKeyToken=b800c4cfcdeea87b' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Since I'm unfamiliar with this ecosystem, I'm trying to figure out where the problem lies with the dependency juggling and how to best resolve it.

Thanks for any help you can provide!

rongriffin commented 9 years ago

Did NuGet put an assembly redirect for Magnum in your app.config or web.config? If so, copy that into MassTransit.Host.RabbitMq.exe.config and you should be set.

That is the .config file that is used by the host exe.

SeanKilleen commented 9 years ago

You are correct -- it does appear that an assembly redirect was added. I copied it and it appeared to be fine. Thanks!

ghost commented 8 years ago

I'm having the same issue with the dependency Castle.Windsor -- it's look for 3.2, but finding 3.3 -- which I need to use. I don't under this MassTransit.Host.RabbitMQ.exe.config -- where should it be located? What is generating it? I don't see it.

I'm also getting errors when the install.ps1 script runs from the NuGet package. Is this why it's failing to generate a config file?

rongriffin commented 8 years ago

Check to see if NuGet added an app.config to your project. If it did, grab the assembly redirects from it and add it to MassTransit.Host.RabbitMq.exe.config

ghost commented 8 years ago

It didn't add an app.config. Additionaly, I don't see where it's generating a MassTransit.Host.RabbitMQ.exe.config -- where would this be located?

ghost commented 8 years ago

Found it. It wasn't "included" in the project. It was empty, so I added the following:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <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>
    </assemblyBinding>
  </runtime>
</configuration>

But same issue.

ghost commented 8 years ago

Actually, now I get:

Exception thrown: 'System.Security.SecurityException' in mscorlib.dll
Exception thrown: 'System.Security.SecurityException' in System.dll
Exception thrown: 'System.Security.SecurityException' in NLog.dll
Exception thrown: 'System.IO.FileLoadException' in MassTransit.Host.RabbitMQ.exe
Topshelf.Hosts.ConsoleRunHost Error: 0 : An exception occurred, System.IO.FileLoadException: Could not load file or assembly 'MassTransit, Version=2.9.0.0, Culture=neutral, PublicKeyToken=b8e0e9f2f1e657fa' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'MassTransit, Version=2.9.0.0, Culture=neutral, PublicKeyToken=b8e0e9f2f1e657fa'
   at MassTransit.Host.RabbitMQ.ServiceHost.Start()
   at MassTransit.Host.RabbitMQ.Program.<>c.<Main>b__0_3(ServiceHost tc)
   at Topshelf.ServiceConfiguratorExtensions.<>c__DisplayClass7`1.<WhenStarted>b__6(T service, HostControl control)
   at Topshelf.Builders.DelegateServiceBuilder`1.DelegateServiceHandle.Start(HostControl hostControl)
   at Topshelf.Hosts.ConsoleRunHost.Run()

So, it's no longer Castle.Windsor. So, I added all the redirects from teh app.config to the other config, but I get the same error as above. With regard to MassTransit. My current config looks like this:


<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="MassTransit" publicKeyToken="b8e0e9f2f1e657fa" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="NLog" publicKeyToken="5120e14c03d0593c" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Castle.Core" publicKeyToken="407dd0808d44fbdc" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.3.0.0" newVersion="3.3.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="RabbitMQ.Client" publicKeyToken="89e7d7c5feba84ce" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.5.6.0" newVersion="3.5.6.0" />
      </dependentAssembly>
      <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>
      <dependentAssembly>
        <assemblyIdentity name="MassTransit.WindsorIntegration" publicKeyToken="b8e0e9f2f1e657fa" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>
rongriffin commented 8 years ago

Did you install MassTransit.Host.RabbitMq from NuGet into a class library?

ghost commented 8 years ago

It's a console application, using TopShelf. And yes, it was installed from NuGet. It's been working fine for months. I do see now that it's throwing errors when the NuGet tries to run the install.ps1

I know there's been some issues with NuGet 3 and install.ps1 scripts, and VS 2015 Update 2 and install.ps1 scripts. What exactly does this script do? Perhaps this is related?

ghost commented 8 years ago

Progress! It wasn't copying the updated config file to the bin directory, but now it does, with the binding redirects. It's no longer having issues with Castle.Windsor or MassTransit -- but I do get this now:

Exception thrown: 'System.TypeLoadException' in MassTransit.Host.RabbitMQ.exe
Topshelf.Hosts.ConsoleRunHost Error: 0 : An exception occurred, System.TypeLoadException: Could not load type 'MassTransit.BusConfigurators.ServiceBusConfigurator' from assembly 'MassTransit, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b8e0e9f2f1e657fa'.
   at MassTransit.Host.RabbitMQ.ServiceHost.Start()
   at MassTransit.Host.RabbitMQ.Program.<>c.<Main>b__0_3(ServiceHost tc)
   at Topshelf.ServiceConfiguratorExtensions.<>c__DisplayClass7`1.<WhenStarted>b__6(T service, HostControl control)
   at Topshelf.Builders.DelegateServiceBuilder`1.DelegateServiceHandle.Start(HostControl hostControl)
   at Topshelf.Hosts.ConsoleRunHost.Run()
rongriffin commented 8 years ago

MassTransit 3.0 and later is not compatible with this library because 3.0 has breaking changes from 2.x.

With this project try version 2.10 of MassTransit.

rongriffin commented 8 years ago

Also, can you do the following just to make verify you can work in the simplest state:

  1. Create a Class Library (not console application).
  2. Install MassTransit.Host.RabbitMq from Nuget.
  3. Edit MassTransit.Host.RabbitMq.exe.config with your RabbitMQ endpoint and credentials.
  4. Run.

The Topshelf host should start up.