1

Here is my Action:

Imports PagedList

<EmployeeAuthorize()>
Function SearchFoods(Optional ByVal date1 As String = "", Optional ByVal keyword As String = "", Optional page As Integer = 1) As ActionResult

    If String.IsNullOrEmpty(date1) Then
        date1 = Date.Now
    End If

    If String.IsNullOrEmpty(keyword) Then
        keyword = Nothing
    End If

    Dim food = db.Tbl_Foods.Where(Function(x) x.Shrt_Desc.Contains(keyword)).OrderBy(Function(x) x.Food_ID).ToList

    For Each item In food
        item.Shrt_Desc = item.Shrt_Desc.Replace(",", ", ")
    Next

    ViewBag.MyDate = date1
    ViewBag.MyKeyword = keyword

    ' set the page size and number
    Dim pageSize = 20
    Dim pageNumber = page

    TempData("CurrentPage") = "My Wellness"
    TempData("CurrentWellnessPage") = "Food Log"
    Return View("", "_FinalWellnessSubPageLayout", food.ToPagedList(pageNumber, pageSize))

End Function

I believe this is caused, somehow, by the "ToPagedList" since this is the first time I am using it. It works fine on local, but not when I publish to the server. The stack trace looks like this:

[VerificationException: Operation could destabilize the runtime.]
PagedList.PagedList1..ctor(IEnumerable1 superset, Int32 pageNumber, Int32 pageSize) +0
PagedList.PagedListExtensions.ToPagedList(IEnumerable`1 superset, Int32 pageNumber, Int32 pageSize) +62

It also says:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

What is the exception? How can I find what exception "occurred during the execution?"

Does anyone know how to fix this error on the server? Thank you.

user1477388
  • 20,790
  • 32
  • 144
  • 264

1 Answers1

1

I also faced the same problem with IIS 7.5 it was working fine with IIS 6.0 so I reinstalled the Pagedlist package and it worked like a charm.