System.IProgress не поддерживается для асинхронного шаблона на основе задач
У меня есть сервис WCF, IMyService. В этом сервисе есть операция, которая использует System.IProgress.
public async Task MyOperation(int id, IProgress<long> progress)
Я использовал Autofac для создания клиента для сервиса IMyService
builder.Register(c => c.Resolve<ChannelFactory<IMyService>>().CreateChannelWithIssuedToken(xmlToken)).As<IMyService>()
Теперь я получаю эту ошибку:
[NotSupportedException: The use of 'System.IProgress`1[System.Int32]' on the task-based asynchronous method is not supported.]
System.ServiceModel.Description.TaskOperationDescriptionValidator.EnsureParametersAreSupported(MethodInfo method) +5776097
System.ServiceModel.Description.TaskOperationDescriptionValidator.Validate(OperationDescription operationDescription, Boolean isForService) +16119179
System.ServiceModel.Description.ServiceEndpoint.Validate(Boolean runOperationValidators, Boolean isForService) +546
System.ServiceModel.Channels.ServiceChannelFactory.BuildChannelFactory(ServiceEndpoint serviceEndpoint, Boolean useActiveAutoClose) +74
System.ServiceModel.ChannelFactory.OnOpening() +30
System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +261
System.ServiceModel.ChannelFactory.EnsureOpened() +119
System.ServiceModel.ChannelFactory`1.CreateChannel(EndpointAddress address, Uri via) +161
System.ServiceModel.ChannelFactory`1.CreateChannelWithIssuedToken(SecurityToken issuedToken) +39
TSANDC.Mdb.UI.Web.<>c__DisplayClass10.<RegisterServiceEndpoint>b__f(IComponentContext c) in c:\Projects\MyProject\App_Start\AutofacConfig.cs:148
Autofac.Builder.<>c__DisplayClass1`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p) +15
Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +32
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +86
Autofac.Core.Resolving.InstanceLookup.Execute() +62
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +170
Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +124
Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +272
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +86
Autofac.Core.Resolving.InstanceLookup.Execute() +62
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +170
Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) +50
Ошибка об асинхронном шаблоне на основе задач не поддерживает IProgress. Это не кажется правильным, может кто-нибудь, пожалуйста, помогите.