开发者

Database '...\DATABASE.MDF' cannot be upgraded because it is read-only or has read-only files

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 :

Database '...\DATABASE.MDF' cannot be upgraded because it is read-only or has read-only files

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.

开发者_JS百科The application was written with .Net Framework 3.5 SP1


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


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) ?


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 :-)


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.


You add Users group into the sercurity tab with Full Control

Database '...\DATABASE.MDF' cannot be upgraded because it is read-only or has read-only files

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜