Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NServiceBus - Type was not registered in the serializer - Fix?

We are using NServiceBus in a web application and each time we deploy our code to production, we have to delete the Temporary Files in the folder:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files

We are following the instructions here to fix this:

http://www.nservicebus.com/faq/TypeNotRegisteredInSerializer.aspx

I was wondering if there is a more permanent fix to this? I feel like I am fighting with this every time I deploy new code. What is the best way to handle this from code? If that doesn't work, is it best to just stop the application pools, delete the files, and restart the app pools every time I deploy new code?

Thanks for any advice.

like image 655
Brandon Avatar asked Dec 21 '22 12:12

Brandon


2 Answers

Instead of using Configure.WithWeb(), try instead:

Configure.With(HttpRuntime.BinDirectory)

That way, it will search the actual bin folder in your deployed web application instead of the temporary folder. This is also the default behavior in nservicebus 3.0.

like image 124
Johannes Gustafsson Avatar answered Dec 24 '22 00:12

Johannes Gustafsson


We've hit this too. Haven't found anything better than stopping the app pools, deleting the temp asp.net files and then restarting.

like image 44
Andy Avatar answered Dec 24 '22 00:12

Andy