CSLA WPF TCP Configuration Issue

CSLA WPF TCP Configuration Issue

Old forum URL: forums.lhotka.net/forums/t/8844.aspx


itogroup posted on Tuesday, April 27, 2010

We are trying to move from using .NET remoting to TCP. No one here has used WAS before and I think we may be running into a configuration issue. I've tried stripping everything down to the simplest implementation (no binding configurations, etc.). With the settings below, I can open the service in a browser and I can use the wsHttpBinding endpoint just fine. If I try to use the TCP endpoint, I get the following EndpointNotFoundException at line 232 of DataPortal.cs (CSLA 3.8.1.0) as the Fetch method is called on the proxy:

Could not connect to net.tcp://server:42753/Harld.Data/WcfPortal.svc. The connection attempt lasted for a time span of 00:00:21.1336000. TCP error code 10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

Server's Web.config:

	<system.serviceModel>
		<serviceHostingEnvironment>
			<baseAddressPrefixFilters>
				<add prefix="net.tcp://server:42753"/>
				<add prefix="http://server"/><!-- See note 1 -->
			</baseAddressPrefixFilters>
		</serviceHostingEnvironment>
		<services>
			<service name="Csla.Server.Hosts.WcfPortal">
				<endpoint contract="Csla.Server.Hosts.IWcfPortal" 
					address="net.tcp://server:42753/Harld.Data/WcfPortal.svc" 
binding="netTcpBinding"/> <endpoint contract="Csla.Server.Hosts.IWcfPortal"
address="http://server/Harld.Data/WcfPortal.svc"
binding="wsHttpBinding"/> </service> </services> </system.serviceModel>

Client's App.config:

	<system.serviceModel>
		<client>
			<endpoint	name="WcfDataPortal"
				address="net.tcp://server:42753/Harld.Data/WcfPortal.svc"
				binding="netTcpBinding"
				contract="Csla.Server.Hosts.IWcfPortal">
			</endpoint>
		</client>
	</system.serviceModel>

Note 1: If I take out the baseAddressPrefixFilters section and try to visit the endpoint in a browser, I get the error "This collection already contains an address with scheme http.  There can be at most one address per scheme in this collection."

 

Anyone have any suggestions?

rfcdejong replied on Tuesday, April 27, 2010

Which version of IIS are u running?

If it's 7.5 u might forgot the following

- install non-http feature (so net.tcp:808.* comes available beside to http)
- add the net.tcp protocol to the virtual directory of your site so it looks like  http,net.tcp  (use comma and no spaces!)

i also added netTcpBindingBehaviour, but it isn't needed in your case.
Maybe try the default port as well being 808

itogroup replied on Wednesday, April 28, 2010

I just had our sysadmin check the IIS config (we're using IIS 7) and his response was:

The protocols on the virtual directory are set to “http,net.tcp”.
The net.tcp binding on the site is “42753:server”
The firewall is open.

 

With the HTTP based protocols, you can just open a browser and see if its working and get the error if it's not. Is there anything similar for TCP? I tried using PuTTY to open a Raw protocol connection to the server on port 42753, which just gives me a blank window with a cursor and after about 20 seconds, an error box saying "Network error: Connection timed out" pops up. Can anyone try doing the same to a working server and see what happens?

I think port 808 is already in use on that server, so that's out.

RockfordLhotka replied on Wednesday, April 28, 2010

fiddler is the most common tool for troubleshooting network traffic.

WCF itself has extensive instrumentation and logging capabilities as well, at least in .NET. I don't know about SL though. A good WCF book should provide you with a solid understanding of the trace/log features of WCF.

MichelRenaud replied on Tuesday, June 08, 2010

We've been running into the same problem for the past few days and we're currently looking for solutions.  I found this on a MSDN forum:

Since it is a NetTCPBinding the connection doesn't get closed automatically like with httpbindings.  You must actually call close on the connection every time you are done with it otherwise it will have to wait to timeout.  that is why after a few minutes it would start working again.

Based on this, am I right in assuming that CSLA doesn't explicitely close connections?

RockfordLhotka replied on Tuesday, June 08, 2010

WcfProxy does explicitly call Close() on the proxy object, yes.

Copyright (c) Marimer LLC