473,473 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

IIS wrongly reports 'Permission Denied'

Hi - I have an ASP script which does numerous writes via FSO using ...

Function LogActivity(strText)
Dim fso, f
Dim strTime
strTime = ABCNOW()
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile((ABC_OS_ROOT_PATH & "ABCMAINLOG.txt"), 8,
True)
f.WriteLine strTime & " " & strText
f.close
End Function

.... We have recently tripled the number of users using the app have
found that IIS is intermittently reporting 'Permission Denied' while
writing to the log. You can try again a moment later and all will be
well. Has anyone seen this ? It seems very strange that W2K can't deal
with multiple processes/threads writing to the same file without
getting itself confused ! To give you an idea of volume the script is
being invoked up to twice a second at peak times and each invocation
results in approx 150 calls to the above function. That doesn't seem
particularly radical to me but ... By the way the incidence of the
problems seems to be proportional to both the size of the file and the
density of the script requests.

There is a post in this newsgroup from a couple of months back ...

http://tinyurl.com/jyjk

.... which seems to be about the same issue but nothing much in the way
of a reply.

Does anyone know of any known issue with W2K/IIS/FSO which might make
it behave this way ?

regards

Richard Shea.
Jul 19 '05 #1
2 5391
I don't think it's magic - it's just that one process is locking the file
for the update and another process is trying to get access - the same thing
happens with databases, source code control systems, the Application object
(if you use the Lock() method), etc... The longer your files are of course
the longer it'll take to do each update, and the longer the lock will
persist. My logger classes normally start a new log each day - this keeps
file sizes down.

You need to avoid or handle the error. You could use a loop with On Error
Resume Next that continues until a valid reference to the TS is returned
(watch out for infinite loops), or you could arbitrate access by using a
global semaphore/flag that you store in the Application object. When your
logger class gets a reference to the TS it sets the flag and clears it on
release - other instances of your log class enter a wait state (a queue)
until the flag clears. If you wanted to get really tricky maybe MSMQ would
hold some ideas.

Cheers,

Alan
"Richard Shea" <ri*********@fastmail.fm> wrote in message
news:28**************************@posting.google.c om...
Hi - I have an ASP script which does numerous writes via FSO using ...

Function LogActivity(strText)
Dim fso, f
Dim strTime
strTime = ABCNOW()
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile((ABC_OS_ROOT_PATH & "ABCMAINLOG.txt"), 8,
True)
f.WriteLine strTime & " " & strText
f.close
End Function

... We have recently tripled the number of users using the app have
found that IIS is intermittently reporting 'Permission Denied' while
writing to the log. You can try again a moment later and all will be
well. Has anyone seen this ? It seems very strange that W2K can't deal
with multiple processes/threads writing to the same file without
getting itself confused ! To give you an idea of volume the script is
being invoked up to twice a second at peak times and each invocation
results in approx 150 calls to the above function. That doesn't seem
particularly radical to me but ... By the way the incidence of the
problems seems to be proportional to both the size of the file and the
density of the script requests.

There is a post in this newsgroup from a couple of months back ...

http://tinyurl.com/jyjk

... which seems to be about the same issue but nothing much in the way
of a reply.

Does anyone know of any known issue with W2K/IIS/FSO which might make
it behave this way ?

regards

Richard Shea.

Jul 19 '05 #2
"Alan" <SP******************@inspire.net.nz> wrote in message news:<Ob**************@TK2MSFTNGP10.phx.gbl>...
I don't think it's magic - it's just that one process is locking the file
for the update and another process is trying to get access - the same thing
happens with databases, source code control systems, the Application object
(if you use the Lock() method), etc... The longer your files are of course
the longer it'll take to do each update, and the longer the lock will
persist. My logger classes normally start a new log each day - this keeps
file sizes down.
Good idea. We hadn't foreseen the volume of logging that would result
from the system being used in production and this type of approach
would certainly have helped !

You need to avoid or handle the error. You could use a loop with On Error
Resume Next that continues until a valid reference to the TS is returned
(watch out for infinite loops), or you could arbitrate access by using a
global semaphore/flag that you store in the Application object. When your
logger class gets a reference to the TS it sets the flag and clears it on
release - other instances of your log class enter a wait state (a queue)
until the flag clears. If you wanted to get really tricky maybe MSMQ would
hold some ideas.
You've made clear to me that my model of how W2K handles this type of
file was wrong. I was thinking that by default W2K would allow
multiple processes to open and write to the file and would arbitrate
between them. On reflection that was probably a bit hopeful ! Thanks
for the suggestions above for the moment I'm looking at moving the
logging to a database table but if that's too slow I'll try out some
of the above.

regards

richard shea.


Cheers,

Alan
"Richard Shea" <ri*********@fastmail.fm> wrote in message
news:28**************************@posting.google.c om...
Hi - I have an ASP script which does numerous writes via FSO using ...

Function LogActivity(strText)
Dim fso, f
Dim strTime
strTime = ABCNOW()
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile((ABC_OS_ROOT_PATH & "ABCMAINLOG.txt"), 8,
True)
f.WriteLine strTime & " " & strText
f.close
End Function

... We have recently tripled the number of users using the app have
found that IIS is intermittently reporting 'Permission Denied' while
writing to the log. You can try again a moment later and all will be
well. Has anyone seen this ? It seems very strange that W2K can't deal
with multiple processes/threads writing to the same file without
getting itself confused ! To give you an idea of volume the script is
being invoked up to twice a second at peak times and each invocation
results in approx 150 calls to the above function. That doesn't seem
particularly radical to me but ... By the way the incidence of the
problems seems to be proportional to both the size of the file and the
density of the script requests.

There is a post in this newsgroup from a couple of months back ...

http://tinyurl.com/jyjk

... which seems to be about the same issue but nothing much in the way
of a reply.

Does anyone know of any known issue with W2K/IIS/FSO which might make
it behave this way ?

regards

Richard Shea.

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mark E. Hamilton | last post by:
Sorry, I probably should have re-stated the problem: We're using Python 2.3.5 on AIX 5.2, and get the follow error messages from some of our code. I haven't yet tracked down exactly where it's...
10
by: Florian G. Pflug | last post by:
Hi I installed a postgres-application (which was developed on debian woody) on red hat 9 today, using the postgres 7.3 rpms from redhad. One of my the triggers uses the pg_settings table (more...
2
by: Taishi | last post by:
New user of SQL Everything is on the same machine My error is close to the bottom After reading it today, I can see there is a problem with 2 dbases 'PUBS' and 'Master' There are also some...
3
by: Rod | last post by:
I've got a Crystal Reports for Visual Studio.NET 2003 that I wrote. Up until now, I have been able to run it just fine, however, I had to change the access method to use Active Directory. (It...
4
by: stephen | last post by:
Hi, I am getting an error while trying to create an excel file. "Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the...
0
by: debug03 | last post by:
I am executing a DTS package on a Windows 2000 sp4 server running SQL Server 2000 and IBM DB2 V7 client. The DTS package source data(SQL Server) is selected from SQL server table and inserts data to...
0
by: private.anders | last post by:
Hi David! Really need assistance since I have been struggling with a problem long time now. I am running a web application on a Win 2003 Std (Active Directory). Everything works fine. I have...
0
by: private.anders | last post by:
Really need your assistance since I have been struggling with a problem long time now. I am running a web application on a Win 2003 Std (Active Directory). Everything works fine. I have...
4
by: xzzy | last post by:
I have a v1.1 web app that works on my local computer. However, running it at the host computer, the following breaks: when a viewer selects a different country, the State dropdown should...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.