Service Fabric远程处理异常->从v1升级到v2

问题描述

我们有一个应用程序已经在Service Fabric上运行了一段时间,并使用无状态服务进行远程处理。升级到Remoting v2后,某些方法失败,并显示以下错误

system.invalidOperationException: 'Type 'System.String[]' cannot be added to list of kNown types since
 another type 'System.Collections.Generic.IEnumerable`1[System.String]' with the same data contract name 
'http://schemas.microsoft.com/2003/10/Serialization/Arrays:arrayofstring' is already present. If there
 are different collections of a particular type - for example,List<Test> and Test[],they cannot both be 
added as kNown types.  Consider specifying only one of these types for addition to the kNown types list.'

at Microsoft.ServiceFabric.Services.Communication.Client.ServicePartitionClient`1.<InvokeWithRetryAsync>d__23`1.MoveNext()
   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.ServiceFabric.Services.Remoting.V2.Client.ServiceRemotingPartitionClient.<InvokeAsync>d__2.MoveNext()
   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.ServiceFabric.Services.Remoting.Builder.ProxyBase.<InvokeAsyncV2>d__21.MoveNext()
   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()

解决方法

我相信您在使用远程v2时遇到了existing issue。 V2要求将“远程处理Api类型”设置为具体类型。

  • 在合同中不要使用string[],而要使用IServiceRemotingMessageSerializationProvider
  • 或提供.rowClassName1 td:first-child { border-top-left-radius: 10px; border-bottom-left-radius: 10px; } .rowClassName1 td:last-child { border-top-right-radius: 10px; border-bottom-right-radius: 10px; } 的{​​{3}}实现

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...