Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "vallygao"

yes,i did. but i don't understand what causes.here's the log:

ERROR 2015-08-03 16:09:30,907 [73   ] lers.Filters.AbpExceptionFilterAttribute - System.Web.Http.HttpResponseException: Processing of the HTTP request resulted in an exception. Please see the HTTP response returned by the 'Response' property of this exception for details.
   在 System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(HttpRequestMessage request, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)
   在 System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(HttpRequestMessage request, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger)
   在 System.Web.Http.ModelBinding.FormatterParameterBinding.<ExecuteBindingAsyncCore>d__0.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 System.Web.Http.Controllers.HttpActionBinding.<ExecuteBindingAsyncCore>d__0.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()
System.Web.Http.HttpResponseException: Processing of the HTTP request resulted in an exception. Please see the HTTP response returned by the 'Response' property of this exception for details.
   在 System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(HttpRequestMessage request, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)
   在 System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(HttpRequestMessage request, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger)
   在 System.Web.Http.ModelBinding.FormatterParameterBinding.<ExecuteBindingAsyncCore>d__0.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 System.Web.Http.Controllers.HttpActionBinding.<ExecuteBindingAsyncCore>d__0.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()

Thanks for your reply. :D I have added a web api controller,but it still has something confusing me :(

when use the method get ,it's all ok. use the method post without parameter,it' s still noting wrong. but when use the method post with parameters,it returns error"an internal error occured during your request"

here's my code: controller:

public class ContactController : AbpApiController
    {
        Contact[] contacts = new Contact[] { 
            new Contact(){ ID=1, Age=23, Birthday=Convert.ToDateTime("1977-05-30"), Name="Jone", Sex="M"},
            new Contact(){ ID=2, Age=55, Birthday=Convert.ToDateTime("1937-05-30"), Name="Brown", Sex="M"},
            new Contact(){ ID=3, Age=12, Birthday=Convert.ToDateTime("1987-05-30"), Name="Lily", Sex="F"},
            new Contact(){ ID=4, Age=18, Birthday=Convert.ToDateTime("1997-05-30"), Name="Lucy", Sex="F"},
        };

        [HttpGet]
        public virtual IEnumerable<Contact> GetListAll()
        {
            return contacts;
        }

        [HttpPost]
        public virtual IEnumerable<Contact> QueryLists([FromBody]int state)
        {
            return contacts.Where(con=>con.ID==state);
        }
  }

the method get:

$('#send_ajax').click(function(){
                $.ajax({
                    url:'http://...../api/Contact/GetListAll',
                    type:'get',
                    data:{},
                    success:function(data){
                        //alert(data);
                    },
                    error:function(data){
                        //var myjson='';
                    }
                });
            });

the result:

[{"id":1,"name":"Jone","sex":"M","birthday":"1977-05-30T00:00:00","age":23},{"id":2,"name":"Brown","sex":"M","birthday":"1937-05-30T00:00:00","age":55},{"id":3,"name":"Lily","sex":"F","birthday":"1987-05-30T00:00:00","age":12},{"id":4,"name":"Lucy","sex":"F","birthday":"1997-05-30T00:00:00","age":18}]

the method post :

$('#send_ajax').click(function(){
                $.ajax({
                    url:'http://....../api/Contact/QueryLists',
                    type:'post',
                    data:{"state":1},
                    success:function(data){
                        //alert(data);
                    },
                    error:function(data){
                    }
                });
            });

the result:

{"success":false,"result":null,"error":{"code":0,"message":"An internal error occurred during your request!","details":null,"validationErrors":null},"unAuthorizedRequest":false}

Do you have some solutions ?waitting for your good news.

Showing 1 to 2 of 2 entries