我是 ASP.NET MVC 的新手。这个问题对于专业来说应该很容易回答。我正在尝试提交表单(发表评论),但出现错误。
这是我的控制器
[HttpPost]
public ActionResult Index(long id, CommentViewModel comment) {
    var service = new UserService();
    var articleService = new ArticleService();
    comment.UserId = service.GetUserByUsername(User.Identity.Name).UserId;
    comment.ArticleId = id;
    comment.CommentTime = DateTime.Now;
    articleService.AddArticleComment(comment);
    return View();
}
这是我的视图模型
public class CommentViewModel : BaseViewModel {
    public Int64 CommentId { get; set; }
    public Int64 UserId { get; set; }
    public Int64 ArticleId { get; set; }
    public DateTime CommentTime { get; set; }
    public String CommentBody { get; set; }
}
这是我的视图 (HTML)
<form class="form-stacked" id="comment-form" action="@Url.Action("Index", "Article")"   method="post" enctype="multipart/form-data">
    <label class="control-label" for="commentTextArea">Leave a comment...</label>
    <textarea rows="3" id="commentTextArea" name="commentBody" class="span8"></textarea>
                <input type="submit" value="Post Comment" />
</form>
这是网址
http://localhost:58856/Article?Id=1
这是错误消息
The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int64' for method 'System.Web.Mvc.ActionResult Index(Int64, TechCells.Services.ViewModels.CommentViewModel)' in 'TechCells.Web.UI.Controllers.ArticleController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
Parameter name: parameters
我猜 MVC 应该自动检测id来自 URL 的,并根据名称自动分配 ViewModel 属性。正确的?
这个错误的原因是什么?我该如何解决?
谢谢。