1

Let me preface this by saying I don't think this is a duplicate question, but, that may be because I am not fully understanding this issue.

It sounds like this exception is by design, at least according to the many posts I've read. But, this exception is periodically breaking my application. If the web service call is made again, it seems to work (magic!). But, I want that first web service call to work.

This is the exception that is being logged:

System.IO.FileNotFoundException: Could not load file or assembly 'Our.Namespace.Here.ClassName.XmlSerializers' or one of its dependencies. The system cannot find the file specified.
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.LoadWithPartialNameInternal(AssemblyName an, Evidence securityEvidence, StackCrawlMark& stackMark)
   at System.DirectoryServices.AccountManagement.UnsafeNativeMethods.IADsPathname.Retrieve(Int32 lnFormatType)
   at System.DirectoryServices.AccountManagement.ADStoreCtx.LoadDomainInfo()
   at System.DirectoryServices.AccountManagement.ADStoreCtx.get_DnsForestName()
   at System.DirectoryServices.AccountManagement.ADStoreCtx.GetGroupsMemberOf(Principal p)
   at System.DirectoryServices.AccountManagement.Principal.GetGroupsHelper()
   at Our.Different.Namespace.ClassName.FindAccount(FindAccountRequest request, String ip, FindAccountResponse& response)

I do not get this XmlSerializers file as part of my build output when building in release mode. It sounds like I might be able to force the file to be generated, but, how can I get the exception to stop without forcing the file to be generated?

4

2 回答 2

0

这种情况下的问题根源是与 Active Directory 通信的网络问题。然后在尝试序列化 COM 异常期间发生 FileNotFoundException(在 IADsPathname COM 接口中)。此 FileNotFoundException 是 XmlSerializer 正常操作的一部分。它是预期的,将在框架代码中被捕获和处理(它将导致所需的程序集生成)。忽略它并继续。

于 2014-03-10T10:45:49.617 回答
0

我收到了类似的错误消息,而根本原因是 Windows 版本中的这个 AD 错误(https://support.microsoft.com/en-us/kb/2683913),同时使用了 System.DirectoryServices。 .NET 中的 AccountManagement 命名空间。

于 2015-09-23T11:05:49.863 回答