views:

223

answers:

1

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?

EDIT: I just figured, that when using basicHttpBinding, everything works as expected. So the problem can only be in the NetNamedPipeBinding.

Anyone?

A: 

Is this client on the same machine as your service??

netNamedPipeBinding only works on the same machine. If you need to go from machine to machine, use the netTcpBinding instead.

Otherwise, your code seems fine to me - no obvious, glaring omissions or errors.

marc_s
yes, as mentioned in my post, the wcf host is running on the same machine.
Matthias
@Matthias: sorry, missed that....
marc_s