Hi. I am using Log Parser 2.0 COM to parse a IISW3C log file to csv output format from C#.NET. If an error is encountered whilst parsing i catch the error and i want to delete the file. However when i try and delete the csv file i get another error saying that i cannot delete it because
"The process cannot access the file xxx.yyy because it is being used by another process".
How do i get Log Parser to release its file handle so i can delete the csv file?
-----here is the code-----
public static void GetResultsFromBatch(string query)
{
LogQueryClassClass LogParser = new LogQueryClassClass();
COMIISW3CInputContextClassClass pObjInput = new COMIISW3CInputContextClassClass();
COMCSVOutputContextClassClass pObjOutput = new COMCSVOutputContextClassClass();
try
{
LogParser.ExecuteBatch(query, pObjInput, pObjOutput);
}
catch (Exception e)
{
}
finally
{
//LogParser - need to find a way to release the handle or dispose this obj
}
}
Error: [System.IO.IOException] = {"The process cannot access the file 'C:\\test.csv' because it is being used by another process."}
Someone posted the same question here sometime ago but nobody was able to find a solution for this issue :(
Thank you