Error by Implementing of custom ServiceCredentials

Damir Dobric Posts

Next talks:

 

    

Follow me on Twitter: #ddobric



 

 

Archives

While implementing Custom ServiceCredentials class, you may get following error:

Clone() was not implemented properly by 'your type..'. The cloned object was 'System.ServiceModel.Description.ServiceCredentials'.

This error indicates invalid or missing implementation of the method CloneCore(). The problem with service credentials class is that you do not have to implement any method to get i compiled.
This is, because no any method is marked as abstract.  Practically, bot overrides CloneCore() and CreateSecurityTokenmanager() have to be implemnted.

Here is an example which does not implement any of these two methods. When service host is opened (host.Open()) the service model will throw exeption shown above. This is because the type returned in CreateCore() must not be ServiceCredentials. This is exactly what base.CloneCore() retrieves.

image

Following example shows how to simply implement the CloneCore().

image

Last, but not least, following code shows how to start the service with custom ServiceCredentials injected dynamically:

image


Posted Jul 04 2008, 01:32 PM by Damir Dobric
Filed under: ,
developers.de is a .Net Community Blog powered by daenet GmbH.