Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any difference in hosting net.tcp wcf services under Windows 7 and Windows 2008 Server in IIS?

I have a situation where I can't host a service using net.tcp under windows 7 but it works fine on windows 2008 server. I have enabled WAS, and made the same settings in both windows 7 and windows server but for some reason it doesn't work in windows 7. The error I get on the client side is:

System.ServiceModel.EndpointNotFoundException: The message could not be dispatched because the service at the endpoint address 'net.tcp://localhost:908/TcpTest/MySuperService.svc' is unavailable for the protocol of the address.

Server stack trace: 
   at System.ServiceModel.Channels.ConnectionUpgradeHelper.DecodeFramingFault(ClientFramingDecoder decoder, IConnection connection, Uri via, String contentType, TimeoutHelper& timeoutHelper)
   at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble(IConnection connection, ArraySegment`1 preamble, TimeoutHelper& timeoutHelper)
   at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnectionPoolHelper.AcceptPooledConnection(IConnection connection, TimeoutHelper& timeoutHelper)
   at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
   at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open()

And in the event log I got the following error for the service:

An error occurred while trying to listen for the URL '/LM/W3SVC/9/ROOT/TcpTest'. This worker process will be terminated.
 Sender Information: net.tcp
 Exception: System.ServiceModel.WasHosting.TcpAppDomainProtocolHandler/24230272
 Process Name: System.ServiceModel.CommunicationException: The TransportManager failed to listen on the supplied URI using the NetTcpPortSharing service: .
   at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Register()
   at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Open(Boolean isReconnecting)
   at System.ServiceModel.Channels.SharedConnectionListener.StartListen(Boolean isReconnecting)
   at System.ServiceModel.Channels.SharedTcpTransportManager.OnOpenInternal(Int32 queueId, Guid token)
   at System.ServiceModel.Activation.HostedTcpTransportManager.Start(Int32 queueId, Guid token, Action messageReceivedCallback)
   at System.ServiceModel.WasHosting.TcpAppDomainProtocolHandler.OnStart()
   at System.ServiceModel.WasHosting.BaseAppDomainProtocolHandler.StartListenerChannel(IListenerChannelCallback listenerChannelCallback)
 Process ID: w3wp

The web.config is exactly the same for the service on both windows 7 and windows 2008. Any clues?

like image 577
Tomas Jansson Avatar asked Feb 03 '11 15:02

Tomas Jansson


1 Answers

I was having this same problem, in which the exception message ends in

... NetTcpPortSharing service: .

which gives no clue where to go from there.

It turned out that the Net.Tcp Listener Adapter service was pointing to .NET 3 and the Net.TCP Port Sharing Service was pointing to .NET 4

I was able to quickly fix it by running

c:\Windows\Microsoft.NET\Framework64\v4.0.30319\ServiceModelReg.exe -r
like image 148
hortman Avatar answered Oct 19 '22 23:10

hortman