WCF: manually configuring binding and endpoint causes SerciveChannel state corruption
I have created a ComVisible assembly that will be used in a classic-asp application. The assembly should act as a wcf client and connect to the wcf service host (inside the Windows service) on the same machine using named pipes. The wcf service host works great with other clients, so the problem must be with this assembly.
To get it working, I added a link to the ComVisible build and proxy service classes and the appropriate app.config settings were generated for me. Everything is fine so far, except that the config app won't be recognized when creating CreateObject with my assembly in asp code.
I went and tried hardcode (test only) Binding and Endpoint and pass these two constructors of my ClientBase based proxy with this code:
private NetNamedPipeBinding clientBinding = null;
private EndpointAddress clientAddress = null;
clientBinding = new NetNamedPipeBinding();
clientBinding.OpenTimeout = new TimeSpan(0, 1, 0);
clientBinding.CloseTimeout = new TimeSpan(0, 0, 10);
clientBinding.ReceiveTimeout = new TimeSpan(0, 2, 0);
clientBinding.SendTimeout = new TimeSpan(0, 1, 0);
clientBinding.TransactionFlow = false;
clientBinding.TransferMode = TransferMode.Buffered;
clientBinding.TransactionProtocol = TransactionProtocol.OleTransactions;
clientBinding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
clientBinding.MaxBufferPoolSize = 524288;
clientBinding.MaxBufferSize = 65536;
clientBinding.MaxConnections = 10;
clientBinding.MaxReceivedMessageSize = 65536;
clientAddress = new EndpointAddress("net.pipe://MyService/");
MyServiceClient client = new MyServiceClient(clientBinding, clientAddress);
client.Open();
// do something with the client
client.Close();
But this throws the following error:
The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in a failed state.
Environment - .Net Framework 3.5 / C #. What am I missing here?
EDIT: I just thought that when using basicHttpBinding, everything works as expected. Thus, the problem can only be with the NetNamedPipeBinding.
Anyone?
a source to share