Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Used by Another Process

Status
Not open for further replies.

Kinl

Programmer
Mar 19, 2001
168
0
0
US
Hello all,
I have a site that currently gets over 600,000 unique visitors a month with over 350 people on my site at any given time of the day.

I've written some event log code to write to the log any time an exception is thrown. Well its writing to the log every minute or so now with this error:

Message: The process cannot access the file "d:\inetpub\db\credentials.xml" because it is being used by another process. -- Source: mscorlib -- Trace: at System.IO.__Error.WinIOError(Int32 errorCode, String str)

I have a XML file that has my db credentials in it, and all of my apps access this file (which is out of the web root for security) for the DB logon information.

Do I just have too many people on the site at once, therefore inacting the file already in use error? Or what do you think?

Thanks,

kinl
 
Is there a security risk in storing the connection string in the AppSettings of the Web.Config file? If so, I'd love to be made aware so I can avoid the liability.

Have you considered some sort of queing system for the threads trying to access the file? I wonder what kind of performance hit the site would take if you synchronized the threads and issued a lock on the XML file.
 
kinl,

You may want to have your app read in the DB credential file once and cache the info. Like, put it in a static class member, that gets filled with a static constructor. This will definately increase the performance, too.
Code:
class DBConfiguration{

    public static string Credentials;

    static DBConfiguration(){
       
      Credentials = readInFromXMLFile()
       
    }
}

used somewhere else...
Code:
string credentials = DBConnection.Credentials;

HTH

David
[pipe]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top