开发者

Model Binding ASP.NET MVC

So I have a method like the following

  [AcceptVerbs("POST")]
  [RequiresAuthentication()]开发者_高级运维
  public JsonResult SomeEvent(ClientObject myObject)
  {

   }

On my localhost/DEV/QA box the model binding works perfectly. However, when I move this to my production server, no dice. However if I change it to

  [AcceptVerbs("POST")]
  [RequiresAuthentication()]
  public JsonResult SomeEvent(string value1, string value2)
  {

   }

It works perfectly on production. In other words it seems like the ModelBinding is not working.

Some difference in the environments.

  1. On local/dev/qa System.Web.MVC is in the GAC but on my production it's in the BIN.
  2. On prod site is in a web farm but there is 1 primary server getting the traffic. The other is a fail over.

System.Web.MVC does not need to be in the GAC for model binding to work correct?

Seems strange. Any ideas what could prevent ModelBinding to work properly?


Check your View page what does it inherit from if anything? Does the View on the server match up with the view on your localhost box?

For Instance:

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Mvc2Testing.Models.Customer>" %>

What does yours look like? Although the problem is more likely in another file different elsewhere, you didn't specify if you are wiping the target directory on each deployment, or just copying this one dll.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜