c# - How to solve "Error! The requested URL returned 500 - Internal Server Error"- Stack Overflow

admin2025-04-22  0

I'm working with Telerik Grid using databinding Ajax and MVC 3. The first problem I have is When I am going to Load data in Grid , the data loaded successfully. but Some times Its showing the pop up with error meassage "Error! The requested URL returned 500 - Internal Server Error". The second is when I try to filter a value in grid , I am getting the same exception But not in all times.

Can anyone tell me, Why this Error is occuring Some of the times? And How can I solve this problem And How can I stop the error popup showing? Please giude me on this. Thanks.

This is My View code:

@(
Html.Telerik().Grid<ItemValueView>()
           .Name("ItemGrid")
           .Scrollable(scrollable => scrollable.Height("550px"))
           .ClientEvents(events => events
                                       .OnLoad("onLoad")                                                                                      .OnDataBound("onDataBound")
                                       .OnEdit("onEdit")
                                       //.OnSave("onSave")
           )
           .Editable(editing => editing.Mode(GridEditMode.InLine))
           .DataKeys(dataKeys => dataKeys.Add(i => i.ItemKey))
           .DataBinding(dataBinding => dataBinding
                                           //Ajax binding
                                           .Ajax()
                                           .OperationMode(GridOperationMode.Server)
                                           .Select("AjaxToolSelect", "SalesTool")

                                                                                         .Update("AjaxToolUpdate", "SalesTool")
           )

           .Columns(columns =>
                        {
                            columns.Bound(i => i.CustomerName).Title("Customer").ReadOnly();
                            columns.Bound(i => i.DisplayClassKey).Title("Sub Class").ReadOnly();
                            columns.Bound(i => i.Place).Visible(false);
}) 
                                    .Pageable(pager => pager.PageSize(50))
                                    .Sortable(sorting => sorting
                                    .SortMode(GridSortMode.MultipleColumn)
                                    .OrderBy(sortOrder =>
                                                 {
                                                     sortOrder.Add(i => i.CustomerName);
                                                     sortOrder.Add(i => i.DisplayClassKey);

                                                 }))
           .Groupable(grouping => grouping
                                      .Groups(groups => groups.Add(g => g.CustomerName))
           )
           .Filterable()

My Controller is:

    [HttpPost]
    [GridAction]
    public ActionResult AjaxToolSelect()
    {
        var items = DataProvider.GetAllItems(true);
        var grid = new GridModel(items);
        return View(grid);
    }

I'm working with Telerik Grid using databinding Ajax and MVC 3. The first problem I have is When I am going to Load data in Grid , the data loaded successfully. but Some times Its showing the pop up with error meassage "Error! The requested URL returned 500 - Internal Server Error". The second is when I try to filter a value in grid , I am getting the same exception But not in all times.

Can anyone tell me, Why this Error is occuring Some of the times? And How can I solve this problem And How can I stop the error popup showing? Please giude me on this. Thanks.

This is My View code:

@(
Html.Telerik().Grid<ItemValueView>()
           .Name("ItemGrid")
           .Scrollable(scrollable => scrollable.Height("550px"))
           .ClientEvents(events => events
                                       .OnLoad("onLoad")                                                                                      .OnDataBound("onDataBound")
                                       .OnEdit("onEdit")
                                       //.OnSave("onSave")
           )
           .Editable(editing => editing.Mode(GridEditMode.InLine))
           .DataKeys(dataKeys => dataKeys.Add(i => i.ItemKey))
           .DataBinding(dataBinding => dataBinding
                                           //Ajax binding
                                           .Ajax()
                                           .OperationMode(GridOperationMode.Server)
                                           .Select("AjaxToolSelect", "SalesTool")

                                                                                         .Update("AjaxToolUpdate", "SalesTool")
           )

           .Columns(columns =>
                        {
                            columns.Bound(i => i.CustomerName).Title("Customer").ReadOnly();
                            columns.Bound(i => i.DisplayClassKey).Title("Sub Class").ReadOnly();
                            columns.Bound(i => i.Place).Visible(false);
}) 
                                    .Pageable(pager => pager.PageSize(50))
                                    .Sortable(sorting => sorting
                                    .SortMode(GridSortMode.MultipleColumn)
                                    .OrderBy(sortOrder =>
                                                 {
                                                     sortOrder.Add(i => i.CustomerName);
                                                     sortOrder.Add(i => i.DisplayClassKey);

                                                 }))
           .Groupable(grouping => grouping
                                      .Groups(groups => groups.Add(g => g.CustomerName))
           )
           .Filterable()

My Controller is:

    [HttpPost]
    [GridAction]
    public ActionResult AjaxToolSelect()
    {
        var items = DataProvider.GetAllItems(true);
        var grid = new GridModel(items);
        return View(grid);
    }
Share Improve this question edited Sep 10, 2012 at 10:05 SuryaKavitha asked Sep 10, 2012 at 9:24 SuryaKavithaSuryaKavitha 5235 gold badges21 silver badges38 bronze badges 5
  • 1 Relevant code please? :) – Kjartan Commented Sep 10, 2012 at 9:25
  • 1 There are about 2^156 reasons why you might get a 500 error in a web application. Do you want me to enumerate them in an answer or you might for example show your code which would greatly narrow down this number? – Darin Dimitrov Commented Sep 10, 2012 at 9:27
  • 1 Most likely something is breaking on your controller method. Put a breakpoint down and step through your code. – tobias86 Commented Sep 10, 2012 at 9:58
  • I know this isn't helpful but the only time i get 500 error is when asp didnt like some of the characters in the url. Also sometimes when i POST data that looks like a sql injection – user34537 Commented Sep 10, 2012 at 9:59
  • Can any one know How to Hide the reference properties to avoid the circular reference problem in my case? – SuryaKavitha Commented Sep 10, 2012 at 10:15
Add a ment  | 

1 Answer 1

Reset to default 2

500 Internal Server Error is a very generic error. 500 means something went wrong on the server (in this case most likely in the C# code or the view). It doesn't really tell us anything about what went wrong.

To track down the error, there are a few things you can try. If you're running in visual studio, check the output log and see if there are any error messages there. Try setting break points in C# and see what code actually gets executed. If you go to the developer tools in your web-browser, you could find the actual web-request that returns 500 as its status code. as it may have some additional info for you. In Google Chrome you'd do this by pressing F12, going to the network tab, selecting the request and then looking at the preview or response tabs.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745258683a292937.html

最新回复(0)