简体   繁体   English

“无法将对象从…投射到…” WCF回调

[英]“Unable to cast object from … to … ” WCF Callback

Since yesterday I've got a brain screwing bug. 从昨天开始,我有一个脑筋急转弯的错误。 I have a WCF client and a net.tcp hosted WCF service that worked fine for weeks. 我有一个WCF客户端和一个net.tcp托管的WCF服务,可以正常工作数周。 Then after some minor changes, all of the sudden the service crashes on IServiceCallBack callback = OperationContext.Current.GetCallbackChannel<IServiceCallBack>() calls, throwing a "Unable to cast..." Excpetion. 然后,在进行一些小的更改后,服务突然在IServiceCallBack callback = OperationContext.Current.GetCallbackChannel<IServiceCallBack>()调用上崩溃,抛出“无法投射...”异常。 Wherever I don't need callback, everything work fine. 无论我在哪里不需要回调,一切都很好。 It's just like the service doesn't recognize the callback anymore. 就像服务不再识别回调一样。

I saw this could happen when VS has several version of the same assemblies in cache, so I went to C:\\Users\\xxx\\AppData\\Local\\Microsoft\\VisualStudio\\10.0\\ProjectAssemblies and removed all files. 我看到当VS在缓存中具有相同组件的多个版本时,可能会发生这种情况,所以我转到C:\\Users\\xxx\\AppData\\Local\\Microsoft\\VisualStudio\\10.0\\ProjectAssemblies并删除了所有文件。 With no sucess, since the bugs keep happening. 由于漏洞不断发生,因此没有成功。

I even tried, old backups of my solution that worked fine, and now they just crashes the same way. 我什至尝试过,我的解决方案的旧备份效果很好,现在它们只是以相同的方式崩溃。 I'm now totally clueless about this issue. 我现在对这个问题一无所知。

Any help would be very appreciated. 任何帮助将不胜感激。

I've fixed my problem, I actually had 2 WCF look-alike services with look-alike urls and I was using the wrong one (one withouth any callback at all). 我已经解决了我的问题,实际上我有2个WCF类似服务和相似的URL,并且我使用了错误的服务(一个根本没有任何回调)。 I have no idea why my older backups seemed to work beforehand though. 我不知道为什么我的旧备份似乎可以提前工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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