0

我正在我的应用程序上通过 Visual Studio 团队 Server 2005 运行自动化测试。该应用程序是一个 WCF 服务,其 BO 层具有多线程功能。VSTS 上的 userload 为 2,Think Time 为 20 秒(发送一个请求后的等待时间)。但是应用程序通过这样做会收到“ System.Threading.ThreadAbortException ”错误。发生错误的特定区域是 XslCompiledTransform transform.Transform(xmlReader, outputXmlWriter)。 通过这样做,我实际上是在尝试将 xml(在序列化 viewmodel 后生成 xml)提供给 xslt 对象(Transform)。“ System.Threading.ThreadAbortException" 错误不是在正常加载应用程序时发生,而是在多个用户同时访问上述方法时发生。详细错误在下面发布;

  • 日志名称:应用程序来源:Proposal.Service 日期:14/02/2014 1:44:20 AM 事件 ID:100 任务类别:无级别:错误关键字:经典用户:N/A 计算机:
    描述:时间戳:14/02 /2014 上午 6:44:20 消息:HandlingInstanceID:279fbd41-c40c-43aa-bc1a-07d3bc950cc8

    发生并捕获了“System.Threading.ThreadAbortException”类型的异常。

2014 年 2 月 14 日 01:44:20 类型:System.Threading.ThreadAbortException,mscorlib,版本=2.0.0.0,文化=中性,PublicKeyToken=b77a5c561934e089 消息:线程被中止。来源:System.Xml.Xsl.CompiledQuery.1 帮助链接:ExceptionState:数据:System.Collections.ListDictionaryInternal TargetSite:无效(System.Xml.Xsl.Runtime.XmlQueryRuntime,System.Xml.XPath.XPathNavigator)堆栈跟踪:在( XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug} 运行时,XPathNavigator {urn:schemas-microsoft-com:xslt-debug} 当前)在根(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}运行时) 在 System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results) 在 System.Xml.Xsl 的 Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)。1.GetTransformedXml(String inputFileName, Object viewModelPart) at Proposal.Generator.Presenter.BaseClasses.BaseSectionPresenter1. TransformTemplateUsingXslt (String inputXsltName, Stream outpuStream, Object viewModelPart, Boolean addNumberPart, Boolean addstylePart, List 1 richTextPlaceholder, List1 richText, String wordDoc)

4

1 回答 1

0

您说“在多个用户一次同时访问上述方法时发生”。

虽然我看到你的错误来自XslCompiledTransform.Transform(),并且 MSDN 状态The XslCompiledTransform object is thread safe once it has been loaded. In other words, after the Load method has successfully completed, the Transform method can be called simultaneously from multiple threads.,它也状态Note: The Load method is not thread safe when called simultaneously from multiple threads.。您的代码是否有可能做到了这一点(即同时加载),这会导致后面的线程错误?

于 2014-12-05T12:36:40.313 回答