代码之家  ›  专栏  ›  技术社区  ›  mafu

WCF发现:未找到接口异常

  •  1
  • mafu  · 技术社区  · 15 年前

    我正在尝试使用.net 4在WCF中的发现。但无论我做什么,我都会得到一个不太有用的例外:

    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: 
     

    (堆栈跟踪实际上是空的。)

    点击“继续”,程序会阻塞几秒钟,然后继续并显示正确的结果。甚至在微软提供的WCF示例中也会发生这种情况。我确保在VS2010中,只有未处理的异常才会显示在“异常”窗口中。

    我不知道这可能是什么原因造成的,特别是考虑到这个程序除了由异常引起的短暂中断外确实工作得很好。

    在每个使用发现的项目中都会发生异常,包括我创建的项目和微软在官方WCF示例中提供的项目。它只在我的机器上发生,在我同事的盒子上运行良好。

    在我绝望的时候,我在 http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/8e326b48-232c-4510-8194-aa9d4ba36829

    2 回复  |  直到 15 年前
        1
  •  1
  •   Ziriax    9 年前

    我在VS2015更新版3中遇到了完全相同的问题

    对我有用的是 enabling the visual studio hosting process in the offending project properties, debug section

    我试着切换了几次这个复选框,结果是一致的。

        2
  •  1
  •   mafu    15 年前

    问题解决了。

    我重新下载了这些示例并重新安装了VS,但我以前也这么做过,它以前没有改变任何东西。所以我不知道是什么导致或解决了这个问题。祝将来有同样问题的人好运。