Closed MortenChristiansen closed 11 months ago
Hmm I can't seem to "reproduce the reproduction" 😅
I configured the connection string and tenant IT, and I verified in the debugger that they were picked up, but I then got this error when I press F5:
I then added the System.Text.Json NuGet to Repro, and then it started without any problems.
Btw: Your ConfigureRebus
method will create and start a bus instance and immediately shut it down again, because the handler activator is disposed. You should keep either the handler activator or the bus instance around for the entire duration of your application's lifetime, and then dispose them when shutting down.
Btw2: Isn't it possible for you to use .NET? Rebus has really nice hosting integration (via Rebus.ServiceProvider), which makes it possible for you to configure Rebus by going
services.AddRebus(
configure => configure
.Transport(t => t.UseAzureServiceBus(connectionString, queueName))
);
and then have it handle proper start/stop without any additional effort on your part. 🙂
Hmm, it must be something specific to my environment then. Lovely 😕. I'll see if I can get a colleague to repro it tomorrow.
Regarding the other comments, did you mean to ask if I could use .NET Core? Because I am using .NET. I'm adding queue functionality to existing applications which must be able to run on .NET Framework 4.8, so I can't use the services extension method. I was actually unable to find any documentation on how to best use Rebus with a classical ASP.NET application which is why you see me fumbling my way towards a solution 😄. It does not help that I haven't worked with full framework web apps for a long while.
Yes, I meant ".NET Core" even though it's called ".NET" nowadays 😉 (since .NET 5 I believe)
And fair enough, not everyone can have the luxury of working on new stuff all the time.
It's entirely possible to host Rebus inside a classical ASP.NET application, but please be aware that if it's hosted in IIS, then you probably want to configure it to be "always on", unless you only want to process messages while the web app is loaded.
To host it in classic ASP.NET, you'll simply need to figure out how to properly dispose the bus when the web app is closed down – that's the only thing you're missing from the repro code you showed me.
Let me know if you need anything more specific 🙂
I'm having a bit of trouble getting Rebus to work with Azure Service Bus in full framework applications. I have created a minimal .NET Framework 4.8 web application and when I start the bus I get a stack overflow exception.
Repro: https://github.com/MortenChristiansen/Rebus-Full-Framework-Repro You can add a user secrets xml or edit the app settings directly for setting up the
ConnectionString
andTenantId
.The stack trace seems to hint that Rebus is trying to create a Queue: