IIS 7 & IIS 8
IIS Logfiles Location
Last post Aug 15, 2008 05:14 AM by steve schofield
Aug 13, 2008 07:05 PM|LINK
I am trying to read the contents of IIS logfiles using C#, but I do not know how to find where they are. The physical location on my PC is C:\inetpub\logs\LogFiles\W3SVC1.
In my software I am using:
But it says the path does not exist. I am also not sure that the foreach will bring back each file within the directory anyway. I think it will bring back each child directory, which is not what I want.
Can anyone point me in the right direction please.
Aug 14, 2008 02:35 PM|LINK
I do not know how to find where they are. The physical location on my PC is C:\inetpub\logs\LogFiles\W3SVC1.
Look in that folder and see if they really are there. Check permissions on the file/folder.
Aug 14, 2008 08:06 PM|LINK
If all your trying to do is get the logfile names under that directory, try this.
DirectoryInfo iisDir =
myfiles = iisDir.GetFiles();
Like the other reply said, make sure to check the security on the directory.
Aug 15, 2008 05:14 AM|LINK
You are using the IIS provider, do you have the legacy tools installed?
Windows Server MVP - IIS
Log archival solution
Install, Configure, Forget