asp.net-mvc – System.Data.SqlClient.SqlException:无效的对象名称’dbo.Projects’

前端之家收集整理的这篇文章主要介绍了asp.net-mvc – System.Data.SqlClient.SqlException:无效的对象名称’dbo.Projects’前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我的MVC应用程序在尝试访问数据库中的任何表时返回sqlExceptions.

异常详细信息:System.Data.sqlClient.sqlException:无效的对象名称“dbo.Projects”.

我的应用程序我们linq为数据层.

如果我使用旧的dll它工作正常(所以似乎不是一个问题的DB)只是这个最新的应用程序DLL,我已经上传.

细节

[sqlException (0x80131904): Invalid object name ‘dbo.Projects’.]
System.Data.sqlClient.sqlConnection.OnError(sqlException exception,
Boolean breakConnection) +1950890
System.Data.sqlClient.sqlInternalConnection.OnError(sqlException
exception,Boolean breakConnection) +4846875
System.Data.sqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj) +194 System.Data.sqlClient.TdsParser.Run(RunBehavior
runBehavior,sqlCommand cmdHandler,sqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject
stateObj) +2392
System.Data.sqlClient.sqlDataReader.ConsumeMetaData() +33
System.Data.sqlClient.sqlDataReader.get_MetaData() +83
System.Data.sqlClient.sqlCommand.FinishExecuteReader(sqlDataReader ds,
RunBehavior runBehavior,String resetOptionsString) +297
System.Data.sqlClient.sqlCommand.RunExecuteReaderTds(CommandBehavior
cmdBehavior,RunBehavior runBehavior,Boolean returnStream,Boolean
async) +954
System.Data.sqlClient.sqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior,String
method,DbAsyncResult result) +162
System.Data.sqlClient.sqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior,String
method) +32
System.Data.sqlClient.sqlCommand.ExecuteReader(CommandBehavior
behavior,String method) +141
System.Data.sqlClient.sqlCommand.ExecuteDbDataReader(CommandBehavior
behavior) +12 System.Data.Common.DbCommand.ExecuteReader() +12
System.Data.Linq.sqlClient.sqlProvider.Execute(Expression query,
QueryInfo queryInfo,IObjectReaderFactory factory,Object[]
parentArgs,Object[] userArgs,ICompiledSubQuery[] subQueries,Object
lastResult) +975
System.Data.Linq.sqlClient.sqlProvider.ExecuteAll(Expression query,
QueryInfo[] queryInfos,Object[]
userArguments,ICompiledSubQuery[] subQueries) +113
System.Data.Linq.sqlClient.sqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression
query) +344
System.Data.Linq.DataQuery1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
+35 System.Linq.Buffer
1..ctor(IEnumerable1 source) +247 System.Linq.<GetEnumerator>d__0.MoveNext() +108
System.Linq.Buffer
1..ctor(IEnumerable1 source) +259
System.Linq.<GetEnumerator>d__0.MoveNext() +108
System.Collections.Generic.List
1..ctor(IEnumerable1 collection)
+7665172 System.Linq.Enumerable.ToList(IEnumerable
1 source) +61 Mezza_crm.Controllers.ProjectsController.GetProjectList(NameValueCollection form) in C:\mezza_crm\mezza_crm\Controllers\ProjectsController.cs:164
Mezza_crm.Controllers.ProjectsController.List() in
C:\mezza_crm\mezza_crm\Controllers\ProjectsController.cs:53
lambda_method(ExecutionScope,ControllerBase,Object[] ) +39
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase
controller,Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext
controllerContext,IDictionary2 parameters) +178
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext
controllerContext,ActionDescriptor actionDescriptor,IDictionary
2
parameters) +24
System.Web.Mvc.<>c__DisplayClassa.b__7()
+52 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter
filter,ActionExecutingContext preContext,Func1 continuation) +254
System.Web.Mvc.<>c__DisplayClassc.<InvokeActionMethodWithFilters>b__9()
+19 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext
controllerContext,IList
1 filters,
IDictionary`2 parameters) +192
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext
controllerContext,String actionName) +399
System.Web.Mvc.Controller.ExecuteCore() +126
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
+27 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext
requestContext) +7
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext)
+151 System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +57
System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext
httpContext) +7
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+181 System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean& completedSynchronously) +75

解决方法

检查连接字符串中的初始目录参数.可能是您的代码正在为Projects对象查找错误数据库.

例如,如果您具有数据库同步设置,只有主数据库表的一部分被传输,那么如果Linq to sql希望所有表都位于连接字符串指向的数据库中,则可能会遇到此错误.

原文链接:/aspnet/250519.html

猜你在找的asp.Net相关文章