简体   繁体   English

.Net Remoting 接口重载方法

[英].Net Remoting interface overloaded methods

We have a legacy app that uses.Net Remoting (we will soon convert it to use something better)我们有一个使用 .Net Remoting 的遗留应用程序(我们很快会将其转换为使用更好的东西)

We have had an interface dll, shared between client and server, that looks like this我们有一个接口 dll,在客户端和服务器之间共享,看起来像这样

[ServiceContract]
public interface ExampleInterface
{
    [OperationContract]
    List<DataObject> InterfaceMethod(string strParam);
}

About two months ago, we needed a few more parameters so we created a ParameterObject and added a new overloaded function to support it;大约两个月前,我们需要更多的参数,所以我们创建了一个ParameterObject并添加了一个新的重载函数来支持它; while leaving in the old function for older clients.同时为老客户保留旧功能。 So the interface now looks like:所以界面现在看起来像:

[OperationContract]
List<DataObject> InterfaceMethod(string strParam);
[OperationContract]
List<DataObject> InterfaceMethod(ParameterObject parameter)

We have deployed the update and we are getting reports that when older clients try to call the method with the string parameter, an exception is thrown with the message 'Cannot resolve the invocation to the correct method' .我们已经部署了更新,并且我们收到报告称,当旧客户端尝试使用string参数调用该方法时,将抛出异常并显示消息'Cannot resolve the invocation to the correct method' The server's exception stack trace is 100% remoting code.服务器的异常堆栈跟踪是 100% 的远程代码。

I was able to reproduce in house and changing the newer method to a different name solved the issue, but this would mean we would have to update a lot of customers.我能够在内部重现并将较新的方法更改为不同的名称解决了这个问题,但这意味着我们将不得不更新很多客户。

Is method overloading not possible in.Net Remoting?在.Net Remoting 中方法重载是不可能的吗? Are there any work-arounds to this?有什么解决方法吗?

Note : we have several working Remoting interfaces that overload methods, but they all have differing parameter counts, perhaps remoting cannot distinguish between two methods with the same name and same parameter count?注意:我们有几个重载方法的工作 Remoting 接口,但它们都有不同的参数计数,也许远程处理无法区分具有相同名称和相同参数计数的两个方法?

Not sure if this is related to the question.不确定这是否与问题有关。 Ran into the same error in a production environment that uses .NET remoting (no method overloading).在使用 .NET 远程处理(无方法重载)的生产环境中遇到同样的错误。 Found out that one of the reference assemblies were of earlier version than the one used during development.发现其中一个参考程序集的版本比开发期间使用的版本早。

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

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