0

I've the following code:

            var bind = new PollingDuplexHttpBinding();
            bind.MaxReceivedMessageSize = 2147483647;

            EndpointAddress myEndpoint = new EndpointAddress(address);

            try
            {
                var instContext = new InstanceContext(this);
                var fact = new DuplexChannelFactory<IVisuWcfService>(instContext, bind);
               var channel = fact.CreateChannel(myEndpoint);
                this.visuServices.Add(visuService.Name, channel);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message+ex.StackTrace);
            }

the try/catch is there to get the error in the designer.

So now the following: I've a Instance of the class with this code in my datacontext. That means at designtime there will be created a instance of this object. But then i get the following error: Unable to cast object of type 'proxy_xx' to type IVisuWcfService, where xx is a increasing number. But when i've this code in runtime, everything is working well. The error happens in the line: fact.CreateChannel(myEndpoint);

Jochen Kühner
  • 1,385
  • 2
  • 18
  • 43

0 Answers0