第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

ASP.NET MVC:沒有為此對象定義的無參數(shù)構(gòu)造函數(shù)

ASP.NET MVC:沒有為此對象定義的無參數(shù)構(gòu)造函數(shù)

ASP.NET MVC:沒有為此對象定義的無參數(shù)構(gòu)造函數(shù)Server Error in '/' Application.--------------------------------------------------------------------------------No parameterless constructor defined for this object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.MissingMethodException: No parameterless constructor defined for this object.Source Error: Line 16:             HttpContext.Current.RewritePath(Request.ApplicationPath, false);Line 17:             IHttpHandler httpHandler = new MvcHttpHandler();Line 18:             httpHandler.ProcessRequest(HttpContext.Current);Line 19:             HttpContext.Current.RewritePath(originalPath, false);Line 20:         }我正在關(guān)注Steven Sanderson的“ Pro ASP.NET MVC框架 ”一書。在頁132,根據(jù)作者的建議,我下載了ASP.NET MVC Futures程序集,并將其添加到我的MVC項目中。[注意:這可能是一個紅鯡魚。]在此之后,我無法再加載我的項目。上面的錯誤阻止了我。我的問題不是,“你能幫我解決一下我的代碼嗎?”相反,我想更全面地了解:我該如何解決這個問題?我應(yīng)該尋找什么?根本原因是什么?看起來我應(yīng)該比現(xiàn)在更深入地了解路由和控制器。
查看完整描述

3 回答

?
慕勒3428872

TA貢獻(xiàn)1848條經(jīng)驗 獲得超6個贊

我剛遇到類似的問題。當(dāng)a Model沒有無參數(shù)構(gòu)造函數(shù)時,會發(fā)生相同的異常。

調(diào)用堆棧正在計算一個負(fù)責(zé)創(chuàng)建模型新實例的方法。

System.Web.Mvc.DefaultModelBinder。CreateModel(ControllerContext controllerContext,ModelBindingContext bindingContext,Type modelType)


這是一個示例:

public class MyController : Controller{
    public ActionResult Action(MyModel model)
    {

    }}public class MyModel{
    public MyModel(IHelper helper) // MVC cannot call that
    {
        // ...
    }

    public MyModel() // MVC can call that
    {
    }}


查看完整回答
反對 回復(fù) 2019-08-08
?
牧羊人nacy

TA貢獻(xiàn)1862條經(jīng)驗 獲得超7個贊

您需要與控制器對應(yīng)的操作沒有參數(shù)。

看起來你有控制器/動作組合:

public ActionResult Action(int parameter){}

但你需要

public ActionResult Action(){}

另外,查看Phil Haack的Route Debugger來排除路由故障。


查看完整回答
反對 回復(fù) 2019-08-08
  • 3 回答
  • 0 關(guān)注
  • 1696 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號