问题描述
$.ajax执行这action的时候直接报错跟踪不到错误publicJsonResultDoAction(JObjectrequest){varmessage=newsys_userService().Login(request);returnJson(message,JsonRequestBehavior.DenyGet);}昨天错误没有写全实在抱歉新手轻虐“/”应用程序中的服务器错误。没有为该对象定义无参数的构造函数。说明:执行当前Web请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。异常详细信息:System.MissingMethodException:没有为该对象定义无参数的构造函数。源错误:执行当前Web请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。堆栈跟踪:[MissingMethodException:没有为该对象定义无参数的构造函数。]System.RuntimeTypeHandle.CreateInstance(RuntimeTypetype,BooleanpublicOnly,BooleannoCheck,Boolean&canBeCached,RuntimeMethodHandleInternal&ctor,Boolean&bNeedSecurityCheck)+0System.RuntimeType.CreateInstanceSlow(BooleanpublicOnly,BooleanskipCheckThis,BooleanfillCache,StackCrawlMark&stackMark)+113System.RuntimeType.CreateInstanceDefaultCtor(BooleanpublicOnly,BooleanskipCheckThis,BooleanfillCache,StackCrawlMark&stackMark)+206System.Activator.CreateInstance(Typetype,BooleannonPublic)+83System.Activator.CreateInstance(Typetype)+11System.Web.Mvc.DefaultModelBinder.CreateModel(ControllerContextcontrollerContext,ModelBindingContextbindingContext,TypemodelType)+200[MissingMethodException:没有为该对象定义无参数的构造函数。对象类型“System.Web.HttpContext”。]System.Web.Mvc.DefaultModelBinder.CreateModel(ControllerContextcontrollerContext,ModelBindingContextbindingContext,TypemodelType)+235System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContextcontrollerContext,ModelBindingContextbindingContext)+502System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContextcontrollerContext,ModelBindingContextbindingContext)+345System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContextcontrollerContext,ParameterDescriptorparameterDescriptor)+289System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContextcontrollerContext,ActionDescriptoractionDescriptor)+124System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__19(AsyncCallbackasyncCallback,ObjectasyncState)+904System.Web.Mvc.Async.WrappedAsyncResult`1.CallBeginDelegate(AsyncCallbackcallback,ObjectcallbackState)+30System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallbackcallback,Objectstate,Int32timeout)+114System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallbackcallback,Objectstate,BeginInvokeDelegatebeginDelegate,EndInvokeDelegate`1endDelegate,Objecttag,Int32timeout)+71System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeAction(ControllerContextcontrollerContext,StringactionName,AsyncCallbackcallback,Objectstate)+307System.Web.Mvc.Controller.<BeginExecuteCore>b__1c(AsyncCallbackasyncCallback,ObjectasyncState,ExecuteCoreStateinnerState)+46System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallbackcallback,ObjectcallbackState)+43System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallbackcallback,Objectstate,Int32timeout)+114System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallbackcallback,ObjectcallbackState,BeginInvokeDelegate`1beginDelegate,EndInvokeVoidDelegate`1endDelegate,TStateinvokeState,Objecttag,Int32timeout,SynchronizationContextcallbackSyncContext)+83System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallbackcallback,Objectstate)+362System.Web.Mvc.Controller.<BeginExecute>b__14(AsyncCallbackasyncCallback,ObjectcallbackState,Controllercontroller)+32System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallbackcallback,ObjectcallbackState)+35System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallbackcallback,Objectstate,Int32timeout)+114System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallbackcallback,ObjectcallbackState,BeginInvokeDelegate`1beginDelegate,EndInvokeVoidDelegate`1endDelegate,TStateinvokeState,Objecttag,Int32timeout,SynchronizationContextcallbackSyncContext)+101System.Web.Mvc.Controller.BeginExecute(RequestContextrequestContext,AsyncCallbackcallback,Objectstate)+338System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.BeginExecute(RequestContextrequestContext,AsyncCallbackcallback,Objectstate)+30System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__4(AsyncCallbackasyncCallback,ObjectasyncState,ProcessRequestStateinnerState)+53System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallbackcallback,ObjectcallbackState)+43System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallbackcallback,Objectstate,Int32timeout)+114System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallbackcallback,ObjectcallbackState,BeginInvokeDelegate`1beginDelegate,EndInvokeVoidDelegate`1endDelegate,TStateinvokeState,Objecttag,Int32timeout,SynchronizationContextcallbackSyncContext)+83System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBasehttpContext,AsyncCallbackcallback,Objectstate)+290System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContexthttpContext,AsyncCallbackcallback,Objectstate)+67System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContextcontext,AsyncCallbackcb,ObjectextraData)+30System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+103System.Web.HttpApplication.ExecuteStep(IExecutionStepstep,Boolean&completedSynchronously)+155版本信息:Microsoft.NETFramework版本:4.0.30319;ASP.NET版本:4.6.1055.0
解决方案
本帖最后由 wolf3987 于 2016-05-12 16:35:13 编辑
解决方案二:
应该不是这里的问题、你的Controller有没有构造函数?有的话删掉试试