.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

WCF ChannelFactory

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :WCF

Okay, so as the title states, I'm trying to use a WCF ChannelFactory and I'm having no luck.  I keep getting weird issues so I thought I'd create a simple example first, get that working, then apply to my main app.  So here's the setup: I have 3 projects, one called ConsoleApp (give you a guess what that project contains), one called Types (this contains the Interface for my service) and the last called WCF (the service implementation).

Here's what the interface and concrete look like:

namespace Types
    public interface IService1
        string SayHello();


public class Service1 : Types.IService1
        public string SayHello()
            return "Hello";


Now, in the console app, I have a Factory class that looks like this:

public class Factory

View Complete Post

More Related Resource Links

CLR type reflection when creating a channel using the ChannelFactory

In the Xsd that represents our canonical model, a complex type has various choices (several xsd:elements within xsd:choice) – i.e. the property when deserialized into C# has several XmlElement attributes decorated above it….

[System.Xml.Serialization.XmlElementAttribute("exampleRequest1", typeof(ExampleRequest1))]

[System.Xml.Serialization.XmlElementAttribute("exampleRequest1", typeof(ExampleRequest2))]

[System.Xml.Serialization.XmlElementAttribute("exampleRequest1", typeof(ExampleRequest200))]

[System.Xml.Serialization.XmlElementAttribute("exampleRequest1", typeof(ExampleRequest201))]

WCF 3.5 - ChannelFactory question


In a proxy base class we could retry calling a service operation one more time to figure out if exception was due to a timeout or an unhandled server exception. I saw an exemple were the client channel is set to null and ChannelFactory<T>.CreateChannel() method called to recreate the channel. In this context is it necessary to call .Abort() prior to setting the faulted channel object to null? or just set to null and recreate? I did not understood why the person who wrote the example did not call Abort first. Second is it necessary to recreate the factory (ChannelFactory<T>) ? I saw another example were the ChannelFactory<T> object was checked for the state and set to null and recreated. Kind of confused and was thinking if necessary especially in those cases where you want to keep the factory object ChannelFactory<T> cached (say for asp.net scenarious) and we may get a faulted channel


ChannelFactory / close?


Does ChannelFactory<T> need to be explicitly closed?  I currently close all the channels generated from my ChannelFactory<T> but not the factory itself.  I noticed it indirectly implements close and was curious of the ramifications of not closing the factory (using net.tcp with .net 4.0).



ChannelFactory / thread safe?


Is ChannelFactory<T>.CreateChannel thread safe in .NET 4.0?  Would like to use as a singleton dependency via castle windsor.





ChannelFactory Cache in WCF 4.5

A ChannelFactory basically creates a Channel for WCF clients to communicate with WCF service endpoint.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend