Multiple Simultaneous file writes with HMC4 on Classic ASP - asp-classic

I am using Hosted Messaging and Collaboration v4.0 on Classic ASP. My website can have multiple instances depending on how many users are currently logged in. When ever this HMC4 is being used, it logs everything by creating a text file. There is only 1 text file per day, and all HMC4 instances must access this single file to log the usage.
Once in a while I get the error Access to path **** is denied. I have all the permissions set, so the problem is most likely when multiple instances of the application try to write to the log file at the same time.
I am lost at how to fix this, modifying the logging method is impossible since HMC4 is a Microsoft's product and I don't have source code for it, and handling the exception is not an ideal option since I will have to modify the code +70 times across the website.
Any ideas? Thank You.

Related

How to prevent useless disk access for Web Api endpoints?

I'm trying to optimize our .Net 4.0 Web Api Server (Classic 64 bits) and by tracing disk access I found out that whenever I hit a WebApi url (/collections/products/4452) IIS does several disk access. It tries to check for the existence of all these files and directories (using procmon.exe):
/collections
/collections/web.config
/collections/products/
/collections/products/web.config
The IIS server serves content from a UNC path (because it's a Web Farm) so all those useless disk access add up. Tracing reveals that this adds up to 8ms of latently.
I'm trying to figure out how to prevent those file accesses.
So far I have tried.
Remove all handlers except the ExtensionlessUrlHandler-ISAPI-4.0_64bit
Remove all handlers from both <system.web><httpHandlers> and <system.webServer><handlers> and write a dummy handler that returns 'Hello World'
In both cases the file checks still occur (using procmon.exe). I'm about to try and write a low level C++ module but before we go that way I wanted to ask advice here.
I suspect that before going in my handler it does some magic in aspnet_isapi.dll, but since I can't access the code, I would hope that there is some configuration I could attempt before moving forward.

ADODB recordset error "Operation is not allowed when the object is open" (3705)

I have a legacy ASP application that I support. By support I mean that I haven't touched it since about 2005 because its just worked.
However there were a couple of data issues in the Access database that the ASP application uses. So like a fool I opened the database directly over a fileshare (using MS Access 2007), fixed the data and saved it down (in Access 2000 format).
Now the application will retrieve and display the data OK, but any updates fail with the error 3705: Operation is not allowed when the object is open. I have not changed the code in any way, the only change was the data update and database save.
I've found plenty of examples of this error, but they all relate to fairly simple issues like ensuring the recordset is closed before opening it, changing the CursorLocation enum, etc. I've tried most of these in the vain hope that something will work, but nothing has.
Any ideas how can I fix this?
Thanks.
UPDATE
I've installed a web based access database management system, and have tried to compact and repair the database. I received the error:
The Microsoft Jet database engine cannot open the file '<snip>'. It is
already opened exclusively by another user, or you need permission to view
its data. (-2147217911)
I have run the macro detailed here to determine who is logged onto the database, and just showed the admin user (which was me - while running it)
Those errors mean one thing: the database file is opened by some other process and thus is being locked.
Most likely that "web based access database management system" is the culprit, try to find how you can configure it to not lock the file, or get rid of it.
As a work around or way to verify the real problem, you can copy the .mdb file into different location and change the classic ASP connection string to check if you can update the database in its new location.
#Remou's comment above about checking the file and folder permissions was correct.
I had our server admin check the permissions, and it seems that the write access had dropped off the folder (and the files also inherit their permissions from the folder). He said that this has happened before when saving directly over the fileshare.
(accepting in lieu of an answer from #Remou)

Crystal Reports Viewer: Failed to Open the Connection error

Currently I'm working on a piece of code that involves using the Crystal Reports Viewer to export .RPT files to PDF. My problem is that the code works on literally everything except the website I'm planning to eventually put it on.
When placed on the website it throws back the error "Failed to open the connection." which I believe is connected to the SQL Server connection that's formed in order to read data for the report itself.
The code itself is solid and works when used in a separate console application I built to test it whether said code is run on my local machine or on the server itself. It even runs when I test the website in Visual Studio's virtual host.
I've narrowed it down to being some sort of permissions issue, but I am not knowledgeable enough in the various permissions settings to figure out which ones specifically apply to this situation. It's worth mentioning that other pages on the website are directly connecting to the same database, but they are doing so directly through Linq instead of going through the Crystal Report Viewer.
So does anybody know which settings I need to modify in order to fix the connection error.
An added note: One of the other suggestions is to make sure there's an ODBC DNS in place that matches the one being used by the code. I have created such a DNS already.
Application Pool dictates how your application runs in many ways. You can probably configure the web.config to run under the credentials, or access level of your choice.
Solution for people who didn't read the comments:
Change the identity under the advanced setting's of your application pool to the desired level of access.
Glad I could help.- J

How do I get site usage from IIS?

I want to build a list of User-Url
How can I do that ?
By default, IIS creates log files in the system32\LogFiles directory of your Windows folder. Each website has its own folder beginning in “W3SVC” then incrementing sequentially from there (i.e. “W3SVC1”, “W3SVC2” etc). In there you’ll find a series of log files containing details of each request to your website.
To analyse the files, you can either parse them manually (i.e. suck them into SQL Server and query them) or use a tool like WebTrends Log Analyser. Having said that, if you really want to track website usage you might be better off taking a look at Google Analytics. Much simpler to use without dealing with large volumes of log files or paying heft license fees.
if you have any means of identifying your users via web server logs (e.g. username in the cookie) then you can do it by parsing your web logs and getting info from csUriquery and csCookie fields.
Alternatively you can rely on external tracking systems (e.g Omniture)
I ended up finding the log files in C:\inetpub\logs\LogFiles.
I used Log Parser Studio from Microsoft to parse the data. It has lots of documentation on how to query iis log files, including sample querys.

Flush cached data from IIS?

I'm being asked to look into a problem that occurs intermittently on a WebServer running my team's application.
Essentially, we have a webservice that does a lookup between codes. If you have Code Type A, you can use it to look up the corresponding Code Type B. Periodically, when memory is running low, when this webservice is called, a null reference exception is being thrown. Essentially, this service loads a lookup file into cache with a dependency on the file, so if the file chages, the cache is reloaded with the new file. The priority on the cache object is set to default. I'm guessing that somewhere in the code, it isn't being verified that the cache object is still there and when memory on the server gets low, that object is dumped causing the error. I'd like to be able to recreate the error and verify before I start digging into this code.
Is there a way in IIS manager (or from the command prompt) to force a running web app to dump it's cache? I would think that this should recreate the condition and therefore recreate the bug. Not to mention, seeing the detail error should lead to the right section of code.
Thanks,
Steve Brouillard
My gut reaction would be to set the WebMethod's CacheDuration to zero, then back to whatever you want on an ongoing basis. I haven't tried this, but I think this would dump the cache then start it forming again...
I found a utility that can be added to ASP.NET apps that will allow you to dynamically manage the cache as a whole or individual cache objects. Thanks to .NET Rocks! and dnrtv.
Here's a link to the tool that I used. This allowed me to clear just the specific objects in question, on the fly, and prove the error.
Thanks to everyone for your help. ASP Alliance Cache Manager.
Steve

Resources