我使用Google Checkout ASP.NET控件“GCheckout”突然出现间歇性错误。
它位于第一行代码中:
XmlSerializer Ser = new XmlSerializer(ObjectToSerialize.GetType()); //ObjectToSerialize is a CheckoutShoppingCart object
令我困惑的是为什么它似乎一直在工作,现在只是间歇性地返回下面显示的错误。
这个库对我来说是一个巨大的黑盒子,我是VB.NET的人,而不是C#。
有人可以提出任何建议吗?
/// <summary>
/// Makes XML out of an object.
/// </summary>
/// <param name="ObjectToSerialize">The object to serialize.</param>
/// <returns>An XML string representing the object.</returns>
/// <example>
/// <code>
/// Car MyCar1 = new Car();
/// byte[] CarBytes = EncodeHelper.Serialize(MyCar1);
/// string CarXml = EncodeHelper.Utf8BytesToString(CarBytes);
/// Car MyCar2 = (Car) Deserialize(CarXml, typeof(Car));
/// // MyCar2 is now a copy of MyCar1.
/// </code>
/// </example>
public static byte[] Serialize(object ObjectToSerialize) {
XmlSerializer Ser = new XmlSerializer(ObjectToSerialize.GetType()); //ObjectToSerialize is a CheckoutShoppingCart object
using (MemoryStream MS = new MemoryStream()) {
XmlTextWriter W = new XmlTextWriter(MS, new UTF8Encoding(false));
W.Formatting = Formatting.Indented;
Ser.Serialize(W, ObjectToSerialize);
W.Flush();
W.Close();
return MS.ToArray();
}
}
The assembly with display name 'GCheckout.XmlSerializers' failed to load in the 'LoadFrom' binding context of the AppDomain with ID 9. The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly 'GCheckout.XmlSerializers, Version=1.3.2.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'GCheckout.XmlSerializers, Version=1.3.2.0, Culture=neutral, PublicKeyToken=null'
=== Pre-bind state information ===
LOG: User = NA\MYNAME
LOG: DisplayName = GCheckout.XmlSerializers, Version=1.3.2.0, Culture=neutral, PublicKeyToken=null, processorArchitecture=MSIL
(Fully-specified)
LOG: Appbase = file:///C:/My/Code/BESI/BESI/
LOG: Initial PrivatePath = C:\My\Code\BESI\BESI\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\My\Code\BESI\BESI\web.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/besi/c1115671/77c4386d/GCheckout.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/besi/c1115671/77c4386d/GCheckout.XmlSerializers/GCheckout.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///C:/My/Code/BESI/BESI/bin/GCheckout.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///C:/My/Code/BESI/BESI/bin/GCheckout.XmlSerializers/GCheckout.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/besi/c1115671/77c4386d/GCheckout.XmlSerializers.EXE.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/besi/c1115671/77c4386d/GCheckout.XmlSerializers/GCheckout.XmlSerializers.EXE.
LOG: Attempting download of new URL file:///C:/My/Code/BESI/BESI/bin/GCheckout.XmlSerializers.EXE.
LOG: Attempting download of new URL file:///C:/My/Code/BESI/BESI/bin/GCheckout.XmlSerializers/GCheckout.XmlSerializers.EXE.