简体   繁体   中英

BindingFailure detected error during web service call

I'm getting the following error:

The assembly with display name 'MyWinFormsAssembly' failed to load in the 'LoadFrom' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly 'MyWinFormsAssembly.Services.XmlSerializers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

I know I can skip the error, I know I've received this error doing XML serialization before; but this is happening on a web service call.

That web service call, proceeds to fail, with another error:

Could not load file or assembly 'MyWinFormsAssembly.Services.XmlSerializers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

I actually get two sets of these errors calling the web service back to back; and then the program fails, it just stops, crashes, dead, no more.

What's weird, if I start a new project, I can call the same web service, with the same web service reference code; and it works just fine, in a new WinForms, WPF, WebForms, Console, and MVC project, tested one of each.

But as I add my core dll's, and assemblies back into it; I eventually get this error. I've tried calling this on my very first line of code, and still get the error. I've commented out all other configuration data, offloaded that to another assembly, that again works fine outside my main project, and tried running it again, first line of code, with no config data, everything commented out, and it still fails.

The only half-lead I've gotten somewhere, and I don't really understand it, nor know how to check it, is that I might have a naming conflict?

I've since put the web service in its own XML namespace, and renamed it to be a different name than the windows forms assembly (cause someone had it named the same).

I also renamed the windows forms assembly to a totally different name, and offloaded most of my classes to a separate "core" assembly. I have the web service code itself, its configuration, and everything offloaded to a "service" assembly (the one it can't find XmlSerializers for), and still, it just doesn't work.

I've wracked my brain for almost a week on this, and we're now behind on a production release.

Generating a Serializers.dll using sgen.exe for both the web service, and the service wrapper, and every referenced assembly appears to fix it.

But that doesn't explain the root of why I'm getting the problem in the first place, or how you would debug it; or why I would need to generate a serializer dll? There's got to be a better answer out there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM