Search code examples
c#asp.net-web-apiasp.net-web-api2owinkatana

OWIN Startup: Entry point was not found


The following EntryPointNotFoundException is being thrown in my OWIN Startup configuration upon executing UseWebApi():

EntryPointNotFoundException

An exception of type 'System.EntryPointNotFoundException' occurred in System.Web.Http.Owin.dll but was not handled in user code

Additional information: Entry point was not found.

Web API configuration:

public class WebApiConfig
{
    internal static void Register(HttpConfiguration config)
    {
        // IOC container
        var container = new UnityContainer();
        config.DependencyResolver = new UnityResolver(container);

        // IOC resolution
        Resolver resolver = new Resolver();
        resolver.RegisterTypes(container);

        // Ignore any authentication which happens before the Web API pipeline.
        config.SuppressDefaultHostAuthentication();

        // API attribute routing
        config.MapHttpAttributeRoutes();

        // API formatters
        config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
        config.Formatters.JsonFormatter.SerializerSettings.Converters.Add(new StringEnumConverter());
    }
}

Can anyone help?


Solution

  • The fix was certainly quite odd.

    I noticed that Visual Studio found conflicts between different versions of the System.Net.Http.Formatting assembly.

    After allowing VS to fix the conflicts by adding the binding redirect (double clicking on the warning), every worked fine.

    I don't understand how this could be related my problem.