0

I have a simple WCF Service Library Project (call this Project W) with a handful of DLLs in directory X. I set the startup directory of W to X, all methods work correctly using WcfServiceHost in Visual Studio 2010.

I want to self-host W, so, I created a console Project (call this Project C), added a reference to W, set the startup directory of W to X, then have essentially the following main lines of code

var host = new ServiceHost(typeof(EvalService));
host.Open();

When I now test the methods in W, I am getting System.ServiceModel.FaultException with {"The specified module could not be found. (Exception from HRESULT: 0x8007007E)"}.

What can this mean? How can I tell what module it is trying to load?

I am fairly new to both C# and WCF, any hint would be apprecited.

4

2 回答 2

0

您需要确定此错误是在服务中还是在客户端中。

从错误消息看来,这是一个服务端错误。您可以从http://msdn.microsoft.com/en-us/library/gg281715.aspx实现 IErrorHandler 。

这将使您能够访问服务中的所有错误。然后,您可以记录所有异常及其内部异常。

希望这可以帮助。

于 2013-02-22T05:18:09.410 回答
0

您可以订阅事件 AppDomain.AssemblyResolve 并在调试器中查看哪个程序集有问题。

AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.AssemblyResolve += OnAssemblyResolve;

...

private static Assembly OnAssemblyResolve(object sender, ResolveEventArgs args)
{
   Console.WriteLine(args.RequestingAssembly); //set breakpoint there
   return null;
}
于 2013-02-22T04:13:38.690 回答