title: The process cannot access the file 'filename.xml' because it is being used by another process
body: <p>i have a webservice project c# , when i upload my project @live i get this error :</p>
  
  <blockquote>
    <p>System.IO.IOException: The process cannot access the file
    'E:\Sites\www.bivolino.com\bivolino3D\bivo\imgGal\ProductFeedBeslist.xml'
    because it is being used by another process.    at
    System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)<br>
    at System.IO.FileStream.Init(String path, FileMode mode, FileAccess
    access, Int32 rights, Boolean useRights, FileShare share, Int32
    bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String
    msgPath, Boolean bFromProxy)    at System.IO.FileStream..ctor(String
    path, FileMode mode, FileAccess access, FileShare share)    at
    System.Xml.XmlTextWriter..ctor(String filename, Encoding encoding)<br>
    at ws_og_bivolinogallery.GetItemsBeslist() in
    e:\Sites\www.bivolino.com\bivolino3D\bivo\OpenGarments\og_webservice\App_Code\ws_og_bivolinogallery.cs:line
    1186</p>
  </blockquote>
  
  <p>in my local (local server)all is ok when i run my project but @live(live server) all my methods dosen't work any more.
  here is my code (for exemple for my new method):</p>
  
  <pre><code>[WebMethod(MessageName = "GetItemsBeslist", Description = "Get a list of GAL shirts", CacheDuration = 3600)]
     public XmlDocument GetItemsBeslist()
     {
     XmlTextWriter textWriter = new XmlTextWriter("E:/Sites/www.bivolino.com/bivolino3D/bivo/imgGal/ProductFeedBeslist.xml", Encoding.UTF8);
     //E:/Sites/www.bivolino.com/bivolino3D/bivo/imgGal
     try
     {
         if (bRegisterIP)
         {
             try { LogFiler.ToLog("### IP ### - [" + sRemoteAddress + "]"); }
             catch { }
         }
         XmlDocument xProducts = new XmlDocument();
         XmlElement subElm;
         XmlElement elmAttr;
         XmlNode elmValue;
  
  
         xProducts.CreateXmlDeclaration("1.0", "utf-8", null);
         XmlElement topElm = xProducts.CreateElement("ProductFeed");
         topElm.SetAttribute("version", "1.0");
         topElm.SetAttribute("timestamp", System.DateTime.Now.ToString().Replace(" ", ":"));
         xProducts.AppendChild(topElm);
  
         List&lt;string[]&gt; strarrVelden = new List&lt;string[]&gt;();
         strarrVelden.AddRange(DB.GetItemsBeslist());
         foreach (string[] rij in strarrVelden)
         {
  
             subElm = xProducts.CreateElement("Product");
  
             elmAttr = xProducts.CreateElement("ProductTitle");
             elmValue = xProducts.CreateNode(XmlNodeType.Text, "ProductTitle", null); elmValue.Value = "Herenoverhemd Bivolino " + rij[5].ToString();
             elmAttr.AppendChild(elmValue);
             subElm.AppendChild(elmAttr);
  
             elmAttr = xProducts.CreateElement("Price");
             elmValue = xProducts.CreateNode(XmlNodeType.Text, "Price", null); elmValue.Value = rij[6].ToString().Replace(",", ".");
             elmAttr.AppendChild(elmValue);
             subElm.AppendChild(elmAttr);
  
  
             elmAttr = xProducts.CreateElement("productURL");
             elmValue = xProducts.CreateNode(XmlNodeType.CDATA, "productURL", null); elmValue.Value = rij[1].ToString();
             elmAttr.AppendChild(elmValue);
             subElm.AppendChild(elmAttr);
  
  
             elmAttr = xProducts.CreateElement("Category");
             elmValue = xProducts.CreateNode(XmlNodeType.Text, "Category", null); elmValue.Value = "Herenoverhemd ";
             elmAttr.AppendChild(elmValue);
             subElm.AppendChild(elmAttr);
  
  
             elmAttr = xProducts.CreateElement("ProductDescription");
             elmValue = xProducts.CreateNode(XmlNodeType.Text, "ProductDescription", null); elmValue.Value = rij[2].ToString();
             elmAttr.AppendChild(elmValue);
             subElm.AppendChild(elmAttr);
  
  
  
             topElm.AppendChild(subElm);
         }
  
         textWriter.WriteStartDocument();
  
         xProducts.Save(textWriter);
         textWriter.WriteEndDocument();
         textWriter.Close();
  
         return xProducts;
  
  
     }
     catch (Exception ex)
     {
         return ErrHandle("ERROR - GetItemsBeslist - " + ex.Message, "ERROR - GetItemsBeslist");
     }
  </code></pre>
  
  <p>}</p>
  
  <p>Normally these errors come from unclosed file streams, but I've taken care of that. I guess I've forgotten an important step but cannot figure out where. Thank you very much for your help</p>