Skip to content

MapVersionedODataRoute or MapVersionedODataRoutes always throws an exception #35

Closed
@silkroadscott

Description

@silkroadscott

I've been trying to add versioning to our OData API for the last couple of days but despite working off the samples here I find that my call to MapVersionedODataRoute or MapVersionedODataRoutes (depending on which sample I based my code on) inevitably results in the following exception:

System.MissingMethodException was unhandled by user code
  HResult=-2146233069
  Message=Method not found: 'Void System.Web.OData.Routing.ODataPathRouteConstraint..ctor(System.Web.OData.Routing.IODataPathHandler, Microsoft.OData.Edm.IEdmModel, System.String, System.Collections.Generic.IEnumerable'1<System.Web.OData.Routing.Conventions.IODataRoutingConvention>)'.
  Source=Microsoft.AspNet.OData.Versioning

It's been difficult to troubleshoot as I can't tell what method it can't find. In case it matters, the stack trace is basically identical in each case, aside from the name of the method that I invoked in my code.

StackTrace:
       at System.Web.Http.HttpConfigurationExtensions.MapVersionedODataRoutes(HttpConfiguration configuration, String routeName, String routePrefix, IEnumerable'1 models, IODataPathHandler pathHandler, IEnumerable'1 routingConventions, ODataBatchHandler batchHandler)
       at System.Web.Http.HttpConfigurationExtensions.MapVersionedODataRoutes(HttpConfiguration configuration, String routeName, String routePrefix, IEnumerable'1 models, ODataBatchHandler batchHandler)
       at VersionedAPI.Startup.Configuration(IAppBuilder appBuilder)

or

StackTrace:
       at System.Web.Http.HttpConfigurationExtensions.MapVersionedODataRoute(HttpConfiguration configuration, String routeName, String routePrefix, IEdmModel model, ApiVersion apiVersion, IODataPathHandler pathHandler, IEnumerable'1 routingConventions, ODataBatchHandler batchHandler)
       at System.Web.Http.HttpConfigurationExtensions.MapVersionedODataRoute(HttpConfiguration configuration, String routeName, String routePrefix, IEdmModel model, ApiVersion apiVersion)
       at VersionedAPI.Startup.Configuration(IAppBuilder appBuilder)

Do I possibly need to include another package? Is there a bug in the current release?

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions