给定来自 RssXmlHelper.cs 中 RssToolkit 的以下代码:
/// <summary>
/// Returns XML of the Generic Type.
/// </summary>
/// <param name="rssDocument">The RSS document.</param>
/// <typeparam name="T">RssDocumentBase</typeparam>
/// <returns>string</returns>
public static string ToRssXml<T>(T rssDocument) where T : RssDocumentBase
{
if (rssDocument == null)
{
throw new ArgumentNullException("rssDocument");
}
using (StringWriter output = new StringWriter(new StringBuilder(), CultureInfo.InvariantCulture))
{
XmlSerializer serializer = new XmlSerializer(typeof(T));
serializer.Serialize(output, rssDocument);
return output.ToString();
}
}
在我的 WCF 服务中调用 serializer.Serialize() 时,需要花费大量时间。
我有这个坐在我从我的项目中调用的 WCF 服务中。我踏入其中,果然,这就是问题所在。
然后我在我的解决方案中引用该项目,没问题。
在 WCF 服务中使用它时,我应该做些什么不同的事情吗?
- 更新 -
好的,所以我安装了适用于 Windows 7 和 .NET Framework 4 的 Microsoft Windows SDK,运行 sgne.exe RssToolkit.dll 并收到以下错误:
Error: An attempt was made to load an assembly with in incorrect format [path to rsstoolkit.dll]
- Could not load file or assemply [path to rsstoolkit.dll] or one of its dependencies. This assembly was build by a runtime newer than the currently loaded runtime and cannot be loaded.
我的 RssToolkit 项目的目标框架设置为 4.0,与 .Net 4 的 Windows SDK 匹配。这不正确吗?