私は webservice プロジェクト c# を持っています。プロジェクト @live をアップロードすると、次のエラーが発生します。
System.IO.IOException: 別のプロセスで使用されているため、プロセスはファイル 'E:\Sites\www.bivolino.com\bivolino3D\bivo\imgGal\ProductFeedBeslist.xml' にアクセスできません。System.IO.__Error.WinIOError (Int32 errorCode、文字列の多分フルパス)
で System.IO.FileStream.Init (文字列パス、FileMode モード、FileAccess アクセス、Int32 権限、ブール値の useRights、FileShare 共有、Int32 bufferSize、FileOptions オプション、SECURITY_ATTRIBUTES secAttrs 、String msgPath、Boolean bFromProxy) at System.IO.FileStream..ctor(String パス、FileMode モード、FileAccess アクセス、FileShare 共有) at System.Xml.XmlTextWriter..ctor(String filename、Encoding encoding)
e:\Sites\www.bivolino.com\bivolino3D\bivo\OpenGarments\og_webservice\App_Code\ws_og_bivolinogallery.cs:line 1186 の ws_og_bivolinogallery.GetItemsBeslist() で
私のローカル(ローカルサーバー)では、プロジェクトを実行するとすべて問題ありませんが、@live(ライブサーバー)ではすべてのメソッドが機能しなくなります。これが私のコードです(私の新しいメソッドの例):
[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<string[]> strarrVelden = new List<string[]>();
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");
}
}
通常、これらのエラーは閉じられていないファイル ストリームから発生しますが、私はそれを処理しました。重要なステップを忘れたと思いますが、どこにあるのかわかりません。ご助力ありがとうございます