HttpConfiguration mixes service and service host concerns

Topics: Web Api
Dec 22, 2011 at 10:20 AM
Edited Dec 22, 2011 at 10:35 AM

My host is ASP.NET MVC, and my "web api" (aka service) is in a class library (i.e. the two are separate assemblies).

In the host I new-up HttpConfiguration, enable test client, set CreateInstance delegate, etc.  But then I pass in a ref to the config object to my web api library (in a static init method) so that it can add its media type formatters - a service, not a host, concern IMO.

This works, but seems wrong.  Maybe HttpConfiguration shouldn't mix service and host concerns...

OTOH you may feel that adding the formatters is a host concern(?)