ASP.NET MVC3中的参数错误 [英] Parameter error in ASP.NET MVC3

查看:44
本文介绍了ASP.NET MVC3中的参数错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的用户在我的MVC3应用程序中看到了一个我无法解释的错误。



例外情况是:



    System.ArgumentException:

   参数字典包含参数'extractID'的空条目 

   非可空类型'System.Int32'的方法 

    'System.Web.Mvc.PartialViewResult SelectExtract(Int32)'...



我理解这个异常通常意味着什么,但它不应该是发生在这里,因为提示ID参数肯定是为帖子填写的。



方法是:



    [HttpPost]

    public PartialViewResult SelectExtract(int extractID)

    {...}
$


通过jQuery AJAX调用,并且适用于其他所有人,但不是这个人。我已经在浏览器开发者工具(IE9)中检查过网络流量,并且正如预期的那样,它正确包含一个
extractID = 9 的POST主体。



他们很难刷新,所以我知道他们正在获取最新的javascript文件。



在Chrome浏览器中,以及隐私浏览在IE中的模式,一切都适合这个用户 - 或者如果用户擦除他们的IE历史/缓存/ cookie /等,它的工作原理。所以我假设在IE中发生了一些时髦的事情,但我已经看过几次与几个不同的
用户,所以我不能把它作为一次性的IE故障写下来。


少数用户(可能是1%的用户)发生了六个左右的不同操作,并且非常不一致 - 它发生在int和bool参数中。我确定的一件事是POST主体实际上在那里,至少按照
到浏览器。我还没有看到进入服务器的每一个原始HTTP请求,看看它是否以某种方式被切断。


知道我应该寻找什么吗?

解决方案

知道我应该寻找什么吗?


http://forums.asp.net/1146.aspx/1?MVC的


I've got a user who is seeing an error in my MVC3 application that I can't explain.

The exception is:

    System.ArgumentException:
    The parameters dictionary contains a null entry for parameter 'extractID' 
    of non-nullable type 'System.Int32' for method 
    'System.Web.Mvc.PartialViewResult SelectExtract(Int32)' ...

I understand what this exception usually means, but it shouldn't be happening here, since the extractID parameter is definitely being filled for the post.

The method is:

    [HttpPost]
    public PartialViewResult SelectExtract(int extractID)
    {...}

The call comes via jQuery AJAX, and works for everyone else, but not this person. I've inspected the network traffic in the browser developer tools (IE9), and as expected, it correctly contains a POST body of extractID=9.

They have hard-refreshed, so I know they're getting the most recent javascript files.

In Chrome, and in private browsing mode in IE, everything works fine for this user - or if the user wipes their IE history/cache/cookies/etc., it works. So I'm assuming there's something funky happening in IE, but I've seen this a few times with a few different users, so I can't write it off as a one-time IE glitch.

It has happened to a handful of users, maybe 1% of users, to a half-dozen or so different actions, and is very inconsistent - it happens to both int and bool parameters. The one thing I'm sure of is that the POST body is actually there, at least according to the browser. I haven't gotten to the point of watching every single raw HTTP request that comes into the server, to see if it somehow gets cut off.

Any idea what I should be looking for?

解决方案

Any idea what I should be looking for?

http://forums.asp.net/1146.aspx/1?MVC


这篇关于ASP.NET MVC3中的参数错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆