1

I have a WCF service, IMyService. In this service, there is an operation that uses System.IProgress.

public async Task MyOperation(int id, IProgress<long> progress)

I used Autofac to create a client for IMyService service

builder.Register(c => c.Resolve<ChannelFactory<IMyService>>().CreateChannelWithIssuedToken(xmlToken)).As<IMyService>()

Now, I receive this error:

[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

The error is about Task-based Asynchronous Pattern does not support IProgress. This doesn't seem right, can somebody please help.

Nathan Tuggy
  • 2,237
  • 27
  • 30
  • 38
Nhat Tran
  • 11
  • 4
  • 1
    `IProgress` is for *intra-process* communication, not *internet* communication. It's not sensible as a WCF service call; the protocol just doesn't support that type of communication. – Servy Oct 29 '15 at 18:25

0 Answers0