WCF发现:接口未找到异常
我正在尝试在 WCF 中使用 .net 4 的发现。但无论我做什么,我都会得到这个不太有用的异常:(
System.ArgumentException crossed a native/managed boundary Message=Interface not found. Source=mscorlib StackTrace: at System.RuntimeTypeHandle.VerifyInterfaceIsImplemented(RuntimeTypeHandle handle, RuntimeTypeHandle interfaceHandle) at System.RuntimeType.GetInterfaceMap(Type ifaceType) at Microsoft.VisualStudio.Diagnostics.ServiceModelSink.ServiceMethodResolver.ResolveMethodInfo(Type implementationType, MethodInfo contractMethod) at Microsoft.VisualStudio.Diagnostics.ServiceModelSink.ServiceMethodResolver..ctor(ContractDescription contract, DispatchRuntime runtime, Message request, InstanceContext instanceContext) InnerException:
堆栈跟踪实际上是空的。)
点击“继续”,程序会卡住几秒钟,然后继续并显示正确的结果。即使在 Microsoft 提供的 WCF 示例中也会发生这种情况。我确保在 VS 2010 的异常窗口中只显示未处理的异常。
我不知道可能导致此问题的原因,特别是考虑到程序确实运行良好(除了异常导致的短暂中断)。
这个异常发生在每个使用 Discovery 的项目中,无论是我创建的项目还是 Microsoft 在官方 WCF 示例中提供的项目。它只发生在我的机器上,在我同事的机器上运行良好。
在绝望中,我交叉发布于 http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/8e326b48-232c-4510-8194-aa9d4ba36829
I'm trying to use .net 4's discovery in WCF. But no matter what I do, I'm getting this not very useful exception:
System.ArgumentException crossed a native/managed boundary Message=Interface not found. Source=mscorlib StackTrace: at System.RuntimeTypeHandle.VerifyInterfaceIsImplemented(RuntimeTypeHandle handle, RuntimeTypeHandle interfaceHandle) at System.RuntimeType.GetInterfaceMap(Type ifaceType) at Microsoft.VisualStudio.Diagnostics.ServiceModelSink.ServiceMethodResolver.ResolveMethodInfo(Type implementationType, MethodInfo contractMethod) at Microsoft.VisualStudio.Diagnostics.ServiceModelSink.ServiceMethodResolver..ctor(ContractDescription contract, DispatchRuntime runtime, Message request, InstanceContext instanceContext) InnerException:
(Stack trace is actually empty.)
Hitting "continue", the program chokes for a few seconds, then continues and displays correct results. This happens even in Microsoft's supplied WCF examples. I made sure that only unhandled exceptions are displayed in the exceptions window in VS 2010.
I've got no idea what might be causing this, especially considering the fact that the program does work perfectly except for short break caused by the exception.
The exception occurs in every project that uses Discovery, both those created by me and those supplied by Microsoft in the official WCF examples. It happens only on my machine, it works fine on my co-worker's box.
In my desperation I cross-posted at http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/8e326b48-232c-4510-8194-aa9d4ba36829
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在 VS2015 update 3 中遇到了完全相同的问题
,对我有用的是 在有问题的项目属性、调试部分中启用 Visual Studio 托管进程
我尝试多次切换此复选框,并且行为是一致的。
I was facing exactly the same problem with VS2015 update 3
What worked for me, was enabling the visual studio hosting process in the offending project properties, debug section
I tried toggling this checkbox a few times, and the behavior was consistent.
问题解决了。
我重新下载了示例并重新安装了 VS,但我之前这样做过,但之前没有任何改变。所以我不知道是什么导致或解决了这个问题。祝将来遇到同样问题的人好运。
Problem solved.
I redownloaded the examples and reinstalled VS but I did that before and it did not change anything before. So I've got no clue as to what caused or fixed the issue. Good luck to anyone with the same problem in the future.