数据库“...\DATABASE.MDF”无法升级,因为它是只读的或具有只读文件

发布于 2024-12-02 19:07:09 字数 551 浏览 0 评论 0原文

我想在 WIN XP SP3 上安装 ASP.NET 应用程序,
因此,我在 WinXP SP3 上安装了 IIS 5.1.Net Framework 3.5 SP1MSSQL 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 :

enter image description here

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

月下伊人醉 2024-12-09 19:07:09

您必须编辑权限,允许“网络服务”编辑 MDF 文件。

You must edit permissions, allowing "Network Service" to edit the MDF file.

烂人 2024-12-09 19:07:09

您是否检查了数据库文件的属性(只读属性)和 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) ?

×纯※雪 2024-12-09 19:07:09

我找到了解决方案。
我禁用了 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 :-)

陌伤ぢ 2024-12-09 19:07:09

这很奇怪。事实证明,我的应用程序的一部分正在引用 Sql Server 中的一个 aspnetdb 文件,而另一个文件则试图引用在应用程序中本地创建的文件。

我的连接字符串是用于此的:

<add name="ApplicationServices" 
     connectionString="Data Source=localhost; Initial Catalog=aspnetdb; Integrated Security=True" providerName="System.Data.SqlClient" />

但错误是这样的

使用默认的“ProfileProvider”时出现故障。请使
确保其配置正确。数据库
'C:\WEBSITES\XXXX.SILVERLIGHT\ADMIN\APP_DATA\ASPNETDB.MDF'
无法升级,因为它是只读的、具有只读文件或
用户没有修改某些文件的权限。使
数据库或文件可写,然后重新运行恢复。

我花了一段时间才注意到这是在我的应用程序根目录下,而不是我的应用程序主要部分使用的 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 :

<add name="ApplicationServices" 
     connectionString="Data Source=localhost; Initial Catalog=aspnetdb; Integrated Security=True" providerName="System.Data.SqlClient" />

But the error was this

There was a failure using the default 'ProfileProvider'. Please make
sure it is configured correctly. Database
'C:\WEBSITES\XXXX.SILVERLIGHT\ADMIN\APP_DATA\ASPNETDB.MDF'
cannot be upgraded because it is read-only, has read-only files or the
user does not have permissions to modify some of the files. Make the
database or files writeable, and rerun recovery.

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.

十二 2024-12-09 19:07:09

您可以使用完全控制Users组添加到sercurity选项卡

在此处输入图像描述

You add Users group into the sercurity tab with Full Control

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文