Soap Core fails registering IFaultExceptionTransformer

1.3k Views Asked by At

While starting a new SoapCore service and sending a dummy request with SoapUI, I receive a HTTP500 and the following exception:

No service for type 'SoapCore.Extensibility.IFaultExceptionTransformer' has been registered.

2

There are 2 best solutions below

2
Izzy On BEST ANSWER

Add services.AddSoapCore(); to your services configuration

0
Kemy On

In the ConfigureServices method of the Startup add this line services.TryAddSingleton<IFaultExceptionTransformer, DefaultFaultExceptionTransformer>();

And the DefaultFaultExceptionTransformer is look something like this:

 public class DefaultFaultExceptionTransformer : IFaultExceptionTransformer
    {
        public Message ProvideFault(Exception exception, MessageVersion messageVersion, Message requestMessage, XmlNamespaceManager xmlNamespaceManager)
        {
            return Message.CreateMessage(messageVersion, "Exception", exception.ToString());
        }
    }

You can read more on this here.