views:

816

answers:

0

I have created a duplex service using the WSDualHttpBinding and am trying to set to set the clientBaseAddress so that I can avoid using port 80 which is blocked by IIS. The service works fine when I have IIS stopped and no clientBaseAddress set but as soon as I set it after some time (Seems to be timing out) I get the following exception:

CommunicationObjectFaultedException

Message:

The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.

Server stack trace: at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)

Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at System.ServiceModel.ICommunicationObject.Close(TimeSpan timeout) at System.ServiceModel.ClientBase1.System.ServiceModel.ICommunicationObject.Close(TimeSpan timeout) at System.ServiceModel.ClientBase1.Close() at Gam.MM.EventBroker.Client.EventManager.Dispose() in C:\Development\Multi-Manager\Dev\Framework\Services\EventBroker\Client Interface\EventBroker.Client\EventManager.cs:line 345 at MM.EventBroker.TestHarness.Program.Main(String[] args) in C:\Development\Multi-Manager\Dev\Framework\Services\EventBroker\Tests\MM.EventBroker.TestHarness\Program.cs:line 75

I have tried setting the clientBaseAddress to several values but to no avail. The values I've tried are:

http://localhost:80/ http://localhost:80/EventBroker http://localhost:8080/ http://localhost:8080/EventBroker/ http://MACHINE_NAME:80/ http://MACHINE_NAME:80/EventBroker http://MACHINE_NAME:8080/ http://MACHINE_NAME:8080/EventBroker/

I have tried setting the clientBaseAddress programatically and in configuration. I have also checked that the port is not blocked by running the following code:

string host = "localhost";
int port = 8080;
IPAddress ipAddress = (IPAddress)Dns.GetHostAddresses(host)[0];
try
{
  TcpListener tcpListener = new TcpListener(ipAddress, port);
  tcpListener.Start();
  tcpListener.Stop();
}
catch (SocketException e)
{
  // Catch exception here if port is blocked
}

Should I look into using NetTcpBinding instead? I will not need to set the clientBaseAddress with that. Will I run into similar port problems with that binding?