Directory lookup for the file "D:\IIS\Test\App_Data\aspnet-MvcApplication1-20140318213623.mdf" failed with the operating system error 2(系统找不到指定的文件。). CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Data.SqlClient.SqlException: Directory lookup for the file "D:\IIS\Test\App_Data\aspnet-MvcApplication1-20140318213623.mdf" failed with the operating system error 2(系统找不到指定的文件。). CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
源错误:
行 35: {
行 36: // Create the SimpleMembership database without Entity Framework migration schema
行 37: ((IObjectContextAdapter)context).ObjectContext.CreateDatabase();
行 38: }
行 39: }
|
源文件: d:\WebSiteTest\MvcApplication1\MvcApplication1\Filters\InitializeSimpleMembershipAttribute.cs 行: 37
应该就是文件夹权限的问题 试试把App_Data 的写权限 设给EveryOne.
把数据库文件复制到指定的目录。默认VS发布网站时数据库文件是不复制的
我是手动把发布的文件复制到服务器那里的,数据库的那个APP_data文件夹没动,在服务器提交的文件这些:bin Content Images Scripts Views Global.asax Web.Config
@情义之印: aspnet-MvcApplication1-20140318213623.mdf这个文件服务器上有了吗?
创建文件是否有足够权限?
D:\IIS\Test\App_Data\aspnet-MvcApplication1-20140318213623.mdf
是否存在?
“/”应用程序中的服务器错误。
Directory lookup for the file "C:\IIS\Test\TestMvc\App_Data\aspnet-MvcApplication1-20140319094015.mdf" failed with the operating system error 2(系统找不到指定的文件。). CREATE DATABASE failed. Some file names listed could not be created. Check related errors. 说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Data.SqlClient.SqlException: Directory lookup for the file "C:\IIS\Test\TestMvc\App_Data\aspnet-MvcApplication1-20140319094015.mdf" failed with the operating system error 2(系统找不到指定的文件。). CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
源错误:
执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。 |
堆栈跟踪:
[SqlException (0x80131904): Directory lookup for the file "C:\IIS\Test\TestMvc\App_Data\aspnet-MvcApplication1-20140319094015.mdf" failed with the operating system error 2(系统找不到指定的文件。). CREATE DATABASE failed. Some file names listed could not be created. Check related errors.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +392 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +815 System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4515 System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite) +1390 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) +538 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +290 System.Data.SqlClient.<>c__DisplayClassa.<DbCreateDatabase>b__7(SqlConnection conn) +164 System.Data.SqlClient.SqlProviderServices.UsingConnection(SqlConnection sqlConnection, Action`1 act) +146 System.Data.SqlClient.SqlProviderServices.UsingMasterConnection(SqlConnection sqlConnection, Action`1 act) +3778055 System.Data.SqlClient.SqlProviderServices.DbCreateDatabase(DbConnection connection, Nullable`1 commandTimeout, StoreItemCollection storeItemCollection) +297 System.Data.Objects.ObjectContext.CreateDatabase() +260 MvcApplication1.Filters.SimpleMembershipInitializer..ctor() in d:\项目文档\MvcApplication1\MvcApplication1\Filters\InitializeSimpleMembershipAttribute.cs:37 [InvalidOperationException: 无法初始化 ASP.NET Simple Membership 数据库。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkId=256588] MvcApplication1.Filters.SimpleMembershipInitializer..ctor() in d:\项目文档\MvcApplication1\MvcApplication1\Filters\InitializeSimpleMembershipAttribute.cs:45 [TargetInvocationException: 调用的目标发生了异常。] |
这个数据文件在服务器上不存在的,在服务器配置的只有 bin Content Images Scripts Views Global.asax Web.Config 这些文件