asp.net mvc 2 - System.MissingMethodException: No parameterless constructor defined for this object -


i have elmah controller factorym these steps using elmah makes dont have mark each method in controllers. file telling me dont have parameterless constructor while do

pricelistcontroller

public partial class pricelistcontroller : controller {      public pricelistcontroller()     {     }       [canonicalurlattribute("pricelist")]     [compressionfilter(order = 1)]     [cachefilter(duration = 120, order = 2)]     public virtual actionresult index()     {         godscreationtaxidermyentities context = new godscreationtaxidermyentities();         var viewmodel = new pricelistviewmodel() { pricelistanimals = context.getanimallistforpricelist() };         return view(viewmodel);     }       [compressionfilter(order = 1)]     [cachefilter(duration = 120, order = 2)]     public virtual actionresult list(string animal)     {         godscreationtaxidermyentities context = new godscreationtaxidermyentities();          var viewmodel = new pricelistindexviewmodel() { animalprices = context.getpricelistbyanimal(animal) };         return view(viewmodel);     }  } 

elmahcontrollerfactory.cs

// <summary> /// custom controller factory injects custom attribute  /// on every action invoked controller /// </summary> public class elmahcontrollerfactory : defaultcontrollerfactory {     /// <summary>     /// injects custom attribute      /// on every action invoked controller     /// </summary>     /// <param name="requestcontext">the request context</param>     /// <param name="controllername">the name of controller</param>     /// <returns>an instance of controller</returns>     public override icontroller createcontroller(requestcontext requestcontext, string controllername)     {         var controller = base.createcontroller(requestcontext, controllername);          var c = controller controller;          if (c != null)             c.actioninvoker = new elmahactioninvoker(new handleerrorwithelmahattribute());          return controller;     } } 

i may misunderstanding thought there parameterless constructor there, wrong?

this resolved, deleted parameterless constructor , made new 1 , error went away.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -