这是控制器的一个方法
public string GetProductList(int page, int rows, string number, string pname, string categoryid, string propertyid, string brandid, string sprice, string eprice, string isonsale, string storageID)
http://***:5005/Product/GetProductList?page=1&rows=15
这样访问在本地环境是可以的。
但是在centos7.1 报错:
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1] Request starting HTTP/1.1 GET http://***:5005/Product/GetProductList?page=1&rows=15 info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1] Executing action method Web.Controllers.ProductController.GetProductList (Web) with arguments (1, 15, , , , , , , , , ) - ModelState is Valid fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[0] An unhandled exception has occurred: Cannot perform runtime binding on a null reference Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot perform runtime binding on a null reference at CallSite.Target(Closure , CallSite , Object ) at BLL.ProductBackupBLL.GetPage2(String extsql, String sortsql, Int32 pageIndex, Int32 pageCount, Int32& totalPages, Int32& totalItems) at Web.Controllers.ProductController.GetProductList(Int32 page, Int32 rows, String number, String pname, String categoryid, String propertyid, String brandid, String sprice, String eprice, String isonsale, String storageID) at lambda_method(Closure , Object , Object[] ) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionFilterAsync>d__28.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeAsync>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Session.SessionMiddleware.<Invoke>d__9.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Session.SessionMiddleware.<Invoke>d__9.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>d__6.MoveNext()
Executing action method Web.Controllers.ProductController.GetProductList (Web) with arguments (1, 15, , , , , , , , , ) - ModelState is Valid
意思是说我没有提供后面的参数?找不到?
本地环境测试的时候程序会给没有传参的变量一个默认值。
这个明显是异常了.代码在
at CallSite.Target(Closure , CallSite , Object )
at BLL.ProductBackupBLL.GetPage2(String extsql, String sortsql, Int32 pageIndex, Int32 pageCount, Int32& totalPages, Int32& totalItems)
在这方法里.看看吧.是哪行抛的.或者看看getpage2是个啥东西
getpage2 里面用了dynamic 类型,导致空引用。
但是本地环境运行屁事没有,日了狗了。
从出错信息看应该是数据库访问部分的问题
我本地访问是没有问题的。数据库访问部分有问题我有日志记录的,但是目前没有日志。http的状态是404
提示有 空引用
你这翻译的不错。
我特他妈的局部404,无解。
我有2台服务器(Linux CentOS)。
本地跑起来没问题。发布到第一台服务器也是没问题(64位的)(正常访问User/Index正常返回页面。)。
但是第二台服务器(64位的)就有问题:访问(/User/Index)返回404找不到该页面。但是我访问其他的控制器比如(Movie/Index等等)都能正常返回。
重新发布了好多次都是有这个问题。好奇怪。
部署是使用Nginx做了反向代理的。
这种问题如何百度或者什么思路
发布方式都是“可移植”。