问题描述
我们有一个应用程序已经在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}}实现