The process cannot access the file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John

    The process cannot access the file

    I get this error while reading my config file but it is only occasionally
    and not all the time. I'm not sure why its happening. Does anyone know what
    could be going wrong? Thanks.

    [28/03/2006 14:52:06] The process cannot access the file 'C:\GCC Business
    Layer\GCCBL.con fig' because it is being used by another process. - at
    System.IO.__Err or.WinIOError(I nt32 errorCode, String maybeFullPath)
    at System.IO.FileS tream.Init(Stri ng path, FileMode mode, FileAccess
    access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize,
    FileOptions options, SECURITY_ATTRIB UTES secAttrs, String msgPath, Boolean
    bFromProxy)
    at System.IO.FileS tream..ctor(Str ing path, FileMode mode)
    at GCCBL.CoolFusio n.ReadConfig(St ring myValue)
    *************** *************** *************** *************** **************

    My Code :

    System.IO.FileS tream fsReadXml = new System.IO.FileS tream

    (System.AppDoma in.CurrentDomai n.BaseDirectory + "GCCBL.conf ig",
    System.IO.FileM ode.Open);


    // Create an XmlTextReader to read the file.

    System.Xml.XmlT extReader myXmlReader =

    new System.Xml.XmlT extReader(fsRea dXml);

    // Read the XML document into the DataSet.

    DataSet myDataSet = new DataSet();

    myDataSet.ReadX ml(myXmlReader) ;

    // Close the XmlTextReader

    myXmlReader.Clo se();

    fsReadXml.Dispo se();


  • John

    #2
    Re: The process cannot access the file

    Nobody has any idea?


    "John" <jhughesy@msn.c om> wrote in message
    news:eTuf5fwUGH A.5496@TK2MSFTN GP11.phx.gbl...[color=blue]
    >I get this error while reading my config file but it is only occasionally
    >and not all the time. I'm not sure why its happening. Does anyone know what
    >could be going wrong? Thanks.
    >
    > [28/03/2006 14:52:06] The process cannot access the file 'C:\GCC Business
    > Layer\GCCBL.con fig' because it is being used by another process. - at
    > System.IO.__Err or.WinIOError(I nt32 errorCode, String maybeFullPath)
    > at System.IO.FileS tream.Init(Stri ng path, FileMode mode, FileAccess
    > access, Int32 rights, Boolean useRights, FileShare share, Int32
    > bufferSize, FileOptions options, SECURITY_ATTRIB UTES secAttrs, String
    > msgPath, Boolean bFromProxy)
    > at System.IO.FileS tream..ctor(Str ing path, FileMode mode)
    > at GCCBL.CoolFusio n.ReadConfig(St ring myValue)
    >
    > *************** *************** *************** *************** **************
    >
    > My Code :
    >
    > System.IO.FileS tream fsReadXml = new System.IO.FileS tream
    >
    > (System.AppDoma in.CurrentDomai n.BaseDirectory + "GCCBL.conf ig",
    > System.IO.FileM ode.Open);
    >
    >
    > // Create an XmlTextReader to read the file.
    >
    > System.Xml.XmlT extReader myXmlReader =
    >
    > new System.Xml.XmlT extReader(fsRea dXml);
    >
    > // Read the XML document into the DataSet.
    >
    > DataSet myDataSet = new DataSet();
    >
    > myDataSet.ReadX ml(myXmlReader) ;
    >
    > // Close the XmlTextReader
    >
    > myXmlReader.Clo se();
    >
    > fsReadXml.Dispo se();
    >
    >[/color]


    Comment

    • Jim Hughes

      #3
      Re: The process cannot access the file

      Change

      (System.AppDoma in.CurrentDomai n.BaseDirectory + "GCCBL.conf ig",
      System.IO.FileM ode.Open);
      to

      (System.AppDoma in.CurrentDomai n.BaseDirectory + "GCCBL.conf ig",
      System.IO.FileM ode.Open, System.IO.FileA ccess.Read);

      By default it is opening read/write exclusive use.

      Jim Hughes

      "John" <jhughesy@msn.c om> wrote in message
      news:eTuf5fwUGH A.5496@TK2MSFTN GP11.phx.gbl...[color=blue]
      >I get this error while reading my config file but it is only occasionally
      >and not all the time. I'm not sure why its happening. Does anyone know what
      >could be going wrong? Thanks.
      >
      > [28/03/2006 14:52:06] The process cannot access the file 'C:\GCC Business
      > Layer\GCCBL.con fig' because it is being used by another process. - at
      > System.IO.__Err or.WinIOError(I nt32 errorCode, String maybeFullPath)
      > at System.IO.FileS tream.Init(Stri ng path, FileMode mode, FileAccess
      > access, Int32 rights, Boolean useRights, FileShare share, Int32
      > bufferSize, FileOptions options, SECURITY_ATTRIB UTES secAttrs, String
      > msgPath, Boolean bFromProxy)
      > at System.IO.FileS tream..ctor(Str ing path, FileMode mode)
      > at GCCBL.CoolFusio n.ReadConfig(St ring myValue)
      >
      > *************** *************** *************** *************** **************
      >
      > My Code :
      >
      > System.IO.FileS tream fsReadXml = new System.IO.FileS tream
      >
      > (System.AppDoma in.CurrentDomai n.BaseDirectory + "GCCBL.conf ig",
      > System.IO.FileM ode.Open);
      >
      >
      > // Create an XmlTextReader to read the file.
      >
      > System.Xml.XmlT extReader myXmlReader =
      >
      > new System.Xml.XmlT extReader(fsRea dXml);
      >
      > // Read the XML document into the DataSet.
      >
      > DataSet myDataSet = new DataSet();
      >
      > myDataSet.ReadX ml(myXmlReader) ;
      >
      > // Close the XmlTextReader
      >
      > myXmlReader.Clo se();
      >
      > fsReadXml.Dispo se();
      >
      >[/color]


      Comment

      Working...