VS2010 .NET 4 - This simple app works using my local system. When I publish it on an IIS 7 web server, I get this error when the application runs this Linq query with a containes function.
var results = view_UserInfoRepository.View_UserInfo.Where(x => x.Email.Contains(eMail)).OrderBy(x => x.Email);
Server Error in '/' Application.
Value cannot be null. Parameter name: text Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentNullException: Value cannot be null. Parameter name: text
Source Error:
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.
Stack Trace:
[ArgumentNullException: Value cannot be null. Parameter name: text]
System.Data.Linq.SqlClient.SqlHelpers.GetStringContainsPattern(String text, Char escape, Boolean& usedEscapeChar) +595083 System.Data.Linq.SqlClient.Visitor.TranslateStringMethod(SqlMethodCall mc) +797 System.Data.Linq.SqlClient.Visitor.VisitMethodCall(SqlMethodCall mc) +1149 System.Data.Linq.SqlClient.SqlVisitor.Visit(SqlNode node) +2136 System.Data.Linq.SqlClient.SqlVisitor.VisitExpression(SqlExpression exp) +11 System.Data.Linq.SqlClient.SqlVisitor.VisitSelectCore(SqlSelect select) +48 System.Data.Linq.SqlClient.Visitor.VisitSelect(SqlSelect select) +20 System.Data.Linq.SqlClient.SqlVisitor.Visit(SqlNode node) +1015 System.Data.Linq.SqlClient.SqlVisitor.VisitAlias(SqlAlias a) +16 System.Data.Linq.SqlClient.SqlVisitor.Visit(SqlNode node) +430 System.Data.Linq.SqlClient.SqlVisitor.VisitSource(SqlSource source) +11 System.Data.Linq.SqlClient.SqlVisitor.VisitSelectCore(SqlSelect select) +26 System.Data.Linq.SqlClient.Visitor.VisitSelect(SqlSelect select) +20 System.Data.Linq.SqlClient.SqlVisitor.Visit(SqlNode node) +1015 System.Data.Linq.SqlClient.SqlVisitor.VisitAlias(SqlAlias a) +16 System.Data.Linq.SqlClient.SqlVisitor.Visit(SqlNode node) +430 System.Data.Linq.SqlClient.SqlVisitor.VisitSource(SqlSource source) +11 System.Data.Linq.SqlClient.SqlVisitor.VisitSelectCore(SqlSelect select) +26 System.Data.Linq.SqlClient.Visitor.VisitSelect(SqlSelect select) +20 System.Data.Linq.SqlClient.SqlVisitor.Visit(SqlNode node) +1015 System.Data.Linq.SqlClient.SqlVisitor.VisitAlias(SqlAlias a) +16 System.Data.Linq.SqlClient.SqlVisitor.Visit(SqlNode node) +430 System.Data.Linq.SqlClient.SqlVisitor.VisitSource(SqlSource source) +11 System.Data.Linq.SqlClient.SqlVisitor.VisitSelectCore(SqlSelect select) +26 System.Data.Linq.SqlClient.Visitor.VisitSelect(SqlSelect select) +20 System.Data.Linq.SqlClient.SqlVisitor.Visit(SqlNode node) +1015 System.Data.Linq.SqlClient.SqlProvider.BuildQuery(ResultShape resultShape, Type resultType, SqlNode node, ReadOnlyCollection1 parentParameters, SqlNodeAnnotations annotations) +805 System.Data.Linq.SqlClient.SqlProvider.BuildQuery(Expression query, SqlNodeAnnotations annotations) +155 System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) +132 System.Data.Linq.DataQuery
1.System.Collections.Generic.IEnumerable.GetEnumerator() +34 System.Collections.Generic.List1..ctor(IEnumerable
1 collection) +315 System.Linq.Enumerable.ToList(IEnumerable1 source) +58 TSM.WebUI.Admin.Controllers.UserAdminController.SearchEMail(String eMail, Int32 page) in C:\Users\Jeff\Documents\Visual Studio 2010\Projects\TSM\TSM.WebUI.Admin\Controllers\UserAdminController.cs:180 lambda_method(Closure , ControllerBase , Object[] ) +151 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, 开发者_Go百科IDictionary
2 parameters) +199 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) +27 System.Web.Mvc.<>c__DisplayClassd.<InvokeActionMethodWithFilters>b__a() +56 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func
1 continuation) +267 System.Web.Mvc.<>c_DisplayClassf.b_c() +20 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList1 filters, ActionDescriptor actionDescriptor, IDictionary
2 parameters) +190 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +345 System.Web.Mvc.Controller.ExecuteCore() +115 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +42 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10 System.Web.Mvc.<>c_DisplayClass8.b_4() +34 System.Web.Mvc.Async.<>c_DisplayClass1.b_0() +21 System.Web.Mvc.Async.<>c__DisplayClass81.<BeginSynchronous>b__7(IAsyncResult _) +12 System.Web.Mvc.Async.WrappedAsyncResult
1.End() +55 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +43 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8841105 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184-------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
Well, I suspect the problem is that eMail
is null. The easiest way to check that is to explicitly set eMail
to null before the query on your development box, and see whether that gives the same result. If it does, you need to move on to finding out why it's null in production but not in development.
精彩评论