Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8076939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:22:06+00:00 2026-06-05T15:22:06+00:00

I recently updated from MVC4 beta to the RC and have encountered a small

  • 0

I recently updated from MVC4 beta to the RC and have encountered a small issue with a WebApi project. One of the first things I noticed is that the ServiceResolver was removed. Before it was removed I was using it to register a custom model binder provider in the following way:

IEnumerable<object> modelBinderProviderServices = GlobalConfiguration.Configuration.ServiceResolver.GetServices(typeof(ModelBinderProvider));
List<Object> services = new List<object>(modelBinderProviderServices) { new CustomDynamicObjectModelBinderProvider() };
GlobalConfiguration.Configuration.ServiceResolver.SetServices(typeof(ModelBinderProvider), services.ToArray());

The action which took advantage of this model binder provider has the following signature:

[HttpPut]
public void Put(CustomDynamicObject model)

I tried to replace the old code with the following but with no results:

GlobalConfiguration.Configuration.Services.Add(typeof(ModelBinderProvider), new CustomDynamicObjectModelBinderProvider());

When I tried to PUT data to the given action, the model provider’s GetBinder method is not called and the model paramter is set to null. I was able to make the action use the wanted modelbinder using the ModelBinder attribute by changing the signature of the Acion/method to the following

[HttpPut]
public void Put([ModelBinder(typeof(CustomDynamicObjectModelBinderProvider))] CustomDynamicObject model)

While this works I really wouldn’t like to have to use this syntax in all my controllers/actions.

I think I should mention that my model binder provider is inheriting from:

System.Web.Http.ModelBinding.ModelBinderProvider

I am saying this because I saw that there is another ModelBinderProvider class in the following namespace:

Microsoft.Web.Mvc.ModelBinding

To recap: How to register a custom modelbinder in MVC4 RC WebApi ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:22:07+00:00Added an answer on June 5, 2026 at 3:22 pm

    The model binding rules in Web API have changed since the Beta. The new rules are described in Mike Stall’s post. Model binding for complex types now only works if you explicitly add a ModelBinder attribute to the parameter.

    The parameter binding mechanism has changed again since the Release Candidate, so you probably want to wait for RTM before making too many changes. There are a couple of other options that might work in the RC version – depending on what the source is of the data you are trying to bind (query string or request body).

    • If the source of your data is the request body then you can create a custom MediaTypeFormatter rather than a model binder:

    • If your data comes from the querystring and you want to avoid explicitly including a [ModelBinder] attribute on your parameters, then you may be able to use a combination of a custom TypeConverter and a custom IValueProvider.

    In the RTM version (or current nightlies), you will be able to use a custom HttpParameterBinding if the other options don’t work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently updated from mathematica 7.0 to 8.0, and have now encountered problem with
I have recently updated the GWT SDK from 1.5.3 to 2.0.0 on a project.
I recently updated jasperreport version from 3.5.2 to 4.0.2 and noticed a few changes
I recently updated a rails app from 3.0.4 to 3.2.4 and I have a
Recently I updated Wine (among other things) via port selfupdate from version 1.2 to
Recently, I have updated from MongoDB 1.6 to MongoDB 2.0. I have populated several
I have a bunch of URLs from an old site that I recently updated
Background I have an app that I recently updated to Rails 3.2.1 (from Rails
I have recently updated jQuery from 1.6 to 1.7 and the following has stopped
looks like today is going to be another rubbish one. we have recently updated

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.