This project is read-only.

How do you unregister a service?

May 19, 2009 at 12:42 PM

I use the DataContractMessageSerializer in my code and the latest update has caused me a little problem. 

The default in EndpointBuilder.InitializeEndpoint is to register the XmlMessageLogger, which uses the XmlMessageSerializer, this then chokes on my DataContract messages.  As I'm not intreasted in message logging, I would like to remove the service without having to mod the SSB project directly.

I'm sure I'm missing something here, but I can't seem to find any way to remove the IMessageLogger via endpoint.LocalServices.  How should I do this? 




May 19, 2009 at 5:24 PM

Yikes - that isn't good. It doesn't look like the service manager exposes an unregister at the moment. In the short term, I would create a null implementation of IMessageLogger, and register that implementation using either the RegisterService method of EndpointBuilder during config time, or using the LocalServices object on the endpoint itself, or if you are using an IoC you can register the null logger there. This should override the default logger. In the mean time, I am going to take a closer look at this problem as the default configuration of SSB should not be incompatible with using the DataContractSerializer. Maybe it would be best for users to specifically add logging support if they want it, and leave it off by default. 

May 19, 2009 at 11:50 PM
Edited May 19, 2009 at 11:51 PM

If your looking at changing the defaults to be compatible with the DataContractSerializer then there is also an issue with the XmlSubscriptionRepository.  This is easier to get round as I've just added the Null manager to the IOC and I have my own DB manager when persistence is needed, but something to be aware of.


May 19, 2009 at 11:55 PM

Stephen, can you tell me the specific error you get from these two services when using Data Contract Serializer? I will make adjustments to both to prevent this from happening in the future. Thanks for the heads up.

May 20, 2009 at 2:18 AM


The error I get is

Cannot serialize member MyMessages.TestMessage.LineData of type System.Collections.Generic.IList`1[[System.String, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089]] because it is an interface."

   at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter) .......

\SimpleServiceBus\Utilities\ServiceManager\LocalServiceManager.cs:line 81
   at SimpleServiceBus.Endpoint.EndpointServiceManager.StartService() in SimpleServiceBus\Endpoint\EndpointServiceManager.cs:line 39

 The messages that don't use interfaces or generics work fine.


May 21, 2009 at 5:31 PM

Stepehen, I modified the logging component so that it uses the message serializer you registered with the bus - it will start without issue with your data contract serializer friendly messages. As for the XML Subscription service, that service does not actually serialize custom messages, it only serializes a small data structure to hold subscriptions, so I can't see how that would cause an error. Perhaps it was an older version of SSB. If you continue to experience the problem, let me know, but I think everything should work out of the box for the various serializers.