这是我的行动:
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
我相信这是由“ToPagedList”引起的,因为这是我第一次使用它。它在本地工作正常,但当我发布到服务器时却不行。堆栈跟踪如下所示:
[VerificationException:操作可能会破坏运行时。]
PagedList.PagedList1..ctor(IEnumerable
1 superset, Int32 pageNumber, Int32 pageSize) +0
PagedList.PagedListExtensions.ToPagedList(IEnumerable`1 superset, Int32 pageNumber, Int32 pageSize) +62
它还说:
在执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常起源和位置的信息。
有什么例外?如何找到“执行期间发生的异常”?
有谁知道如何在服务器上修复此错误?谢谢你。