Skip to content

Resolving MvcRouteHandler #42

@dazinator

Description

@dazinator

I have an asp.net core 2.0 application.

In startup I am calling services.AddMvc();

This registers MvcRouteHandler as a singleton.

MvcRouteHandler has two constructors. The greediest one takes an IActionContextAccessor which AFAIK is not ever registered.

When I call app.UseMvc() - it tries to resolve MvcRouteHandler. I then see this exception:

StructureMap.StructureMapConfigurationException: 'No default Instance is registered and cannot be automatically determined for type 'Microsoft.AspNetCore.Mvc.Infrastructure.IActionContextAccessor'

There is no configuration specified for Microsoft.AspNetCore.Mvc.Infrastructure.IActionContextAccessor

1.) new MvcRouteHandler(Default of IActionInvokerFactory, Default of IActionSelector, Default of DiagnosticSource, Default of ILoggerFactory, Default of IActionContextAccessor)
2.) Microsoft.AspNetCore.Mvc.Internal.MvcRouteHandler
3.) Instance of Microsoft.AspNetCore.Mvc.Internal.MvcRouteHandler
4.) Container.GetInstance(Microsoft.AspNetCore.Mvc.Internal.MvcRouteHandler)

What would be the best way to proceed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions