Hi there,
I've created a ComVisible assembly to be used in a classic-asp application. The assembly should act as a wcf client and connect to a wcf service host (inside a windows service) on the same machine using named pipes. The wcf service host works fine with other clients, so the problem must be within this assembly.
In order to get things work I added a service reference to the ComVisible assembly and proxy classes and the corresponding app.config settings were generated for me. Everything fine so far except that the app config would not be recognized when doing an CreateObject with my assembly in the asp code.
I went and tried to hardcode (just for testing) the Binding and Endpoint and pass those two to the constructor of my ClientBase derived proxy using 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 causes the following error:
The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the faulted state.
The environment is .Net Framework 3.5 / C#. What am I missing here?