Table of Contents

AddXmlExceptionResponseFormatter Method

Definition

AddXmlExceptionResponseFormatter(IServiceCollection, Action<XmlFormatterOptions>)

Adds an IHttpExceptionDescriptorResponseFormatter that uses XmlFormatter as engine of serialization to the specified list of services.

public static IServiceCollection AddXmlExceptionResponseFormatter(this IServiceCollection services, Action<XmlFormatterOptions> setup = null)

Parameters

services IServiceCollection

The IServiceCollection to extend.

setup Action<XmlFormatterOptions>

The XmlFormatterOptions which may be configured.

Returns

IServiceCollection

A reference to services so that additional calls can be chained.

Remarks

Configuration of the XmlFormatter is done through a call to GetService<T>(IServiceProvider) retrieving an IOptions<TOptions> implementation of XmlFormatterOptions.

Exceptions

ArgumentNullException

services cannot be null