我有一个连接到 SQLServer Express 数据库文件的网站,用于成员资格和数据存储。所以我有两个 .mdf 文件。以下是连接字符串:
public static string ASPNETDB = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.mdf;Integrated Security=True;User Instance=True;User ID=;Password=; ";
public static string Dok = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\dok.mdf;Integrated Security=True;User Instance=True;User ID=;Password=; ";
现在,在删除并重新安装网站后,我在建立连接的部分遇到了许多错误。以下是错误:
Unable to open the physical file "C:\Inetpub\wwwroot\BSHHD\App_Data\aspnetdb_log.ldf".
Operating system error 5: "5(failed to retrieve text for this error. Reason: 1815)".
Cannot open user default database. Login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.
File activation failure. The physical file name "C:\Inetpub\wwwroot\BSHHD\App_Data
\aspnetdb_log.ldf" may be incorrect.
The log cannot be rebuilt because there were open transactions/users when the database
was shutdown, no checkpoint occurred to the database, or the database was read-only.
This error could occur if the transaction log file was manually deleted or lost due to
a hardware or environment failure.
这很奇怪,因为我没有对网站进行任何更改。我只是从 IIS 中删除它并重新安装它。有人建议我设置用户名和密码并删除集成安全性。但我不知道如何为数据文件设置用户名/密码。