Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ASP.NET & MS Access

0 views
Skip to first unread message

John Koeppe

unread,
Nov 4, 2002, 4:39:29 PM11/4/02
to
I have questions about using Access as the database for
an ASP.NET application.

1. Yes, I know that Access doesn't scale well, but I'm
only trying to capture applications for prospective
undergraduate students and I cannot picture to many
people apply simultaneously.
2. I've created an ASP.NET application on my computer
(for development), and then created a web setup project
to run on our web server computer.
3. After running the setup project on our 'regular'
server, the application worked partially, but in order to
get it to allow writes to the database I/we had to give
the 'ASPNET' user write permission to the database. I
thought the install program might do that. Is there a
better way to do this?
4. Also, my app doesn't seem to allow more than one user
at a time to even read the database. Does the ole
database driver need to create the .ldb file on the
server (as when you run Access normally)? (Error
message: Could not use ''; file already in use.)
5. It seems more difficult that it ought to be to allow
read/write and simultaneous access to that database.

Any suggestions are much appreciated. (I admit I don't
know servers, IIS, or security issues too well.)

Peter O'Reilly

unread,
Nov 4, 2002, 5:04:58 PM11/4/02
to
John,
Please refer to inline comments.
Good luck!
--
Peter O'Reilly

"John Koeppe" <jko...@immaculata.edu> wrote in message
news:b88601c2844a$a77bf400$35ef2ecf@TKMSFTNGXA11...


> I have questions about using Access as the database for
> an ASP.NET application.
>
> 1. Yes, I know that Access doesn't scale well, but I'm
> only trying to capture applications for prospective
> undergraduate students and I cannot picture to many
> people apply simultaneously.

Actually, Access is not too bad for a single web server system (and not for
mission critical, enterprise data). I have found Access can handle about 20
*simultaneous* connections, performing write operations, quite well (any
more and it chokes) and 60+ connections with read only operations (stopped
at 60 as the limiter here was CPU usgae, not the DB). That's respectable
performance and I believe adequate for what you are looking for. Keep the
mdb file on the web server and you will not get hit with additional
communication overhead. Do backup, compact & repair your Access database
regularly as there is a real risk of the file becoming corrputed.

> 2. I've created an ASP.NET application on my computer
> (for development), and then created a web setup project
> to run on our web server computer.
> 3. After running the setup project on our 'regular'
> server, the application worked partially, but in order to
> get it to allow writes to the database I/we had to give
> the 'ASPNET' user write permission to the database. I
> thought the install program might do that. Is there a
> better way to do this?

If you are using the VS.NET installer, change the ReadOnly property to False
in the property pages for the mdb file.
If not, you still need to find a way to specify that the mdb file is
writeable.

> 4. Also, my app doesn't seem to allow more than one user
> at a time to even read the database. Does the ole
> database driver need to create the .ldb file on the
> server (as when you run Access normally)? (Error
> message: Could not use ''; file already in use.)

As alluded to before, you can have more than one connection open at a time;
you just need to be careful with your ADO.NET objects. Make sure you close
all DataReader and Connection objects after using them (e.g. close method).
This will prevent a stray and persistent ldb file from existing and ensure
that the Access db is completely closed up. A good "fall-back" place for
this cleanup code is in the finally code block.

> 5. It seems more difficult that it ought to be to allow
> read/write and simultaneous access to that database.
>

Addressing step 4, should put your troubles to rest for this step.

Kevin Spencer

unread,
Nov 5, 2002, 7:47:28 AM11/5/02
to
Hi John,

> 3. After running the setup project on our 'regular'
> server, the application worked partially, but in order to
> get it to allow writes to the database I/we had to give
> the 'ASPNET' user write permission to the database. I
> thought the install program might do that. Is there a
> better way to do this?

No.

> 4. Also, my app doesn't seem to allow more than one user
> at a time to even read the database. Does the ole
> database driver need to create the .ldb file on the
> server (as when you run Access normally)? (Error
> message: Could not use ''; file already in use.)

Only one user can have the database file open at a time. If a user is using
the database file in the Access program, the file will be locked. As for
your ASP.Net application, as long as nobody is using the database file in
Access, it shouldn't be a problem.

HTH,

--
Kevin Spencer
Microsoft FrontPage MVP
Internet Developer
http://www.takempis.com
Big things are made up of lots of little things.

"John Koeppe" <jko...@immaculata.edu> wrote in message
news:b88601c2844a$a77bf400$35ef2ecf@TKMSFTNGXA11...

Greg Burns

unread,
Dec 11, 2002, 10:19:55 PM12/11/02
to
I was having the same problem that John was (see below). I couldn't get
ASP.NET to read an Access database if it was already open in MS Access. I
had checked all the usually things, made sure ASPNET account had read/write
access to the folder containing the .mdb, so that it could also write the
.ldb lock file. Also made sure ASPNET had rights to the TEMP folder. (which
it appears that it does by default). Still I was getting the "Could not use
''; file already in use." error. So I changed the machine.config so that
ASP.NET now runs under SYSTEM. This fixed the problem. I can now have a
database open in Access and at the same time, read it from a web page.

Question: What are the ramifications of making this change? Seems drastic to
me. If this is just a rights issue, what am I missing? What other rights do
I need to give the ASPNET user, to avoid changing my machine.config file.

Sorry if this has been asked a thousand times, but I couldn't find any other
answer in Google other than change your machine.config. (or switch to SQL
:^)

Thanks,
Greg


"Kevin Spencer" <ke...@takempis.com> wrote in message
news:OBUYNlMhCHA.2256@tkmsftngp12...

Greg Burns

unread,
Dec 13, 2002, 1:39:51 PM12/13/02
to
Downloaded FileMon and took another look. Appears ASPNET didn't have the
rights I thought it did to the database and the folder it resides in. Fixed
that, and the problem cleared up.

Switched my Machine.Config back and all works well.

Thanks!
Greg

"Greg Burns" <greg_...@hotmail.com> wrote in message
news:#Af260YoCHA.2700@TK2MSFTNGP11...

0 new messages