数据库“...\DATABASE.MDF”无法升级,因为它是只读的或具有只读文件
我想在 WIN XP SP3 上安装 ASP.NET 应用程序,
因此,我在 WinXP SP3 上安装了 IIS 5.1
、.Net Framework 3.5 SP1
和 MSSQL 2008 R2
。
然后,我将应用程序文件夹复制到 C:\Inetpub\wwwroot\
接下来,我从 IIS Manager
中的文件夹创建了一个应用程序,并将权限设置如下图所示:
如您所见,我无法写入甚至无法从数据库中读取,每当我想写入数据库时,我都会收到上述异常。
有什么问题吗?
PS:
我在 VMware Workstation 7.1 上使用 Win XP
该应用程序在 Win Vista x86 和 Win7 x64 中运行没有任何问题。
该应用程序是使用 .Net Framework 3.5 SP1 编写的
I wanna install an ASP.NET application on WIN XP SP3,
Thus I've installed IIS 5.1
, .Net Framework 3.5 SP1
and MSSQL 2008 R2
on my WinXP SP3.
Then, I copied my application folder to C:\Inetpub\wwwroot\
Next, I've created an application from my folder in IIS Manager
and I set the permissions as the following image :
As you can see, I can't write and even read from the database and whenever I wanna write into the database I receive the above exception.
What's the wrong with it ?
P.S:
I'm using Win XP on VMware Workstation 7.1
The application is running in Win Vista x86 and Win7 x64 without any problems.
The application was written with .Net Framework 3.5 SP1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您必须编辑权限,允许“网络服务”编辑 MDF 文件。
You must edit permissions, allowing "Network Service" to edit the MDF file.
您是否检查了数据库文件的属性(只读属性)和 ACL 安全权限(在文件级别定义的权限 - 不是在 IIS 管理控制台中)?
Did you check your database file's property (readonly attribute), and ACL security permissions (permissions that are defined on the file level - not in the IIS management console) ?
我找到了解决方案。
我禁用了 Windows 防火墙并通过“允许用户更改我的文件”共享文件夹,现在我可以轻松地写入和读取数据库:-)
I've found the solution.
I disabled the Windows Firewall and shared the folder with `Allow Users to change my files" , and now I can write and read from the database easily :-)
这很奇怪。事实证明,我的应用程序的一部分正在引用 Sql Server 中的一个
aspnetdb
文件,而另一个文件则试图引用在应用程序中本地创建的文件。我的连接字符串是用于此的:
但错误是这样的
我花了一段时间才注意到这是在我的应用程序根目录下,而不是我的应用程序主要部分使用的 Sql Server 版本。
就我而言,我只是重命名了本地创建的 aspnetdb 文件,当我重新运行应用程序时,它只是以默认大小(10240kb 和 504kb)重新创建它们。
我不太确定这是如何发生的,但就我而言,这是一个足够的修复。
我想也许我没有明确使用配置文件提供程序,因此它使用默认设置。应用程序的其余部分使用正确的连接字符串。
This was weird. It turned out part of my application was referencing one
aspnetdb
file in Sql Server and the other was trying to reference one locally created in the application.My connection string was for this :
But the error was this
It took me a while to notice that this was under my application root, and not the Sql Server version that the main part of my application uses.
In my case I just renamed the locally created aspnetdb files and when I reran the pplication it just recreated them at their default sizes (10240kb and 504kb).
I'm not quite sure how this is happening, but i my case this was a sufficient fix.
I think maybe I wasn't using the profile provider explicitly so it was using default settings. The rest of the application was using the correct connection string.
您可以使用
完全控制
将Users
组添加到sercurity选项卡You add
Users
group into the sercurity tab withFull Control