WCF Routing Service with netTcpBinding - wcf

I am using the Wcf Routing Service with the netTcpBinding
I have a WCF Service named ServiceTwo exposing just only one netTcpBinding endpoint
I have a client application consuming the ServiceTwo
Then I have a routingService between them, the routing service has two endpoints, a basicHttpBinding and a netTcpBinding. The routing always use netTcpBinding to communicate with the ServerTwo.
I am using the full IIS 8.5, enabled Http Activation and Non Http Activation, already setup protocol "http, net.tcp" for the ServiceTwo and the routing service as well.
for these below scenarios, it works
if the client application client consumes the ServiceTwo directly, not go through the routing, using netTcpBinding -> it works fine
or the client application call the ServiceTwo through the routing using basicHttpBinding (the routing always use netTcpBinding to communicate with the ServerTwo) -> it also works fine.
But for the case client app using the netTcpBinding to connect to the routing (the routing always use netTcpBinding to communicate with the ServerTwo)
I just got an exception as below:
An unhandled exception of type
System.ServiceModel.CommunicationException' occurred in mscorlib.dll
Additional information: The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:00:59.9659874'.
Could you please advise something I might miss and cause the error
Thank you very much.
Regards

This error occured for me, when my client was using SecurityMode.None, but not my Service. But I think the exception is rather general.
So I would advice you to re-check all values that set up your ServiceChannel incl. your Binding on Service & Client.
btw: this error occurs for me only in case the client sets a SecurityMode and the service does not! If it is vice-versa a more meaningful exception occurs. Namely: (ProtocolException - This could be due to mismatched bindings (for example security enabled on the client and not on the server))

Related

WCF service failing The message could not be dispatched because the service at the endpoint address is unavailable for the protocol of the address

The service is hosted in IIS it works fine but once a week it gives this issue. I checked the code all service calls from client are closed. Also we call these services from Biztalk daily which is net.tcp configured through WCF adapters.
Open a command prompt.
Navigate to c:\windows\microsoft.net\framework64\v4.0.30319.
Register the service model using the command "ServiceModelReg.exe -r".
You can also try to restart the Net.Tcp listener adapter service. This has a similar problem, you can refer to it.

An error occurred while receiving the HTTP response to ''. This could be due to the service endpoint binding not using the HTTP protocol

I am getting the below error while trying to call an external service from my service which was hosted in IIS .
Error : An error occurred while receiving the HTTP response to ''. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.
And I am not getting any error while trying to call the same external service from a console application.
Any suggestions will help. Thanks in advance.
Issue is with the firewall. When i try to call the external service from console application, the service call going through without any errors, as there was no IIS involved in calling the service. But when i call the external service from another service hosted in IIS, firewall comes to the picture.

Silverlight 4, WCF with net.tcp endpoint, proxy not requesting clientaccesspolicy.xml

I've been trying to have my Silverlight application work with a WCF net.tcp binding the whole day and couldn't make it, even though it seems to me I've done everything right, including after some googling...
I had a WCF service with a basicHttpBinding endpoint which worked perfectly, and as my WCF service and my Silverlight application are on the same network, told myself "why not trying something else than HTTP ?"
So I began googling to see what had to be done, and here's the list of what I did :
Server
Checked that Net.Tcp Listener Adapter service was running
IIS
Enabled net.tcp binding on my website, with binding information set to "4502:*"
Added net.tcp protocol to the Application that hosts my WCF service
Added a policy in the clientaccesspolicy.xml file to allow socket connection on ports 4502-4536
WCF Service
Added a net.tcp binding with Security set to None
Added an endpoint with this binding for my service, keeping the regular HTTP one
After doing all this, I can use my WCF service with WcfTestClient, it sees the two endpoints (HTPP and net.tcp), and both of them work like a charm.
In my Silverlight application, I can update my service reference (which I added with the HTTP address of my service, not the TCP one), and it also sees the two endpoints because it added the TCP endpoint in the ServiceReferences.ClientConfig. As I saw when googling, netTcpBinding is not supported in Silverlight, thus it describes the binding as a custom binding with a and a element.
I saw on the different tutorials I followed that, as for the HTTP binding, Silverlight asks for a socket policy file to check if the client has access to the WCF service. In SL4 Beta, this file was requested by TCP on port 943. As of SL4 RC and RTM, it's requested by HTTP on port 80, as it is for the HTTP bindings.
The thing is, when I launch my application with the proxy set to use the net.tcp binding, I checked with Fiddler, the clientaccesspolicy.xml is NOT requested at any time, and I get the classic error when the socket policy file is not present : TCP error code 10013: An attempt was made to access a socket in a way forbidden by its access permissions.
After googling, I found out that SL looks for this file with the IP address of the server, not its name, but trying http://IP_OF_MY_SERVER/clientaccesspolicy.xml in a browser on my client machine serves the file as expected...
So I'm a bit lost here, I would really like to have it working to see something else than HTTP with WCF...
Someone has any bit of a clue to guess what happens ???
As the service works as expected with WcfTestCLient with the net.tcp binding, I'm guessing this has something to do specifically with SL...
Thanks for reading :-)

Silverlight WCF Service to Service calls

Question:
Are there known issues making calls to a service that calls another service from Silverlight?
Scenario:
I have the following 3 projects:
SilverlightClient - Silverlight project with a Button
SilverlightClient.Web - A web application that hosts the SilverlightClient.xap.
BackEnd - A different web application that hosts the FOO Service which does some special backend processing.
I have created a Silverlight WCF-Enabled web service in both SilverlightClient.Web and Backend. These are respectively SilverlightClientService and BackEndService.
From SilverlightClient.Web I add a service reference to BackEndService. I have a test ASPX page that I've written code that calls BackEndService successfully.
From SilverlightClient I add a service reference to SilverlightClient.Web's SilverlightClientService. If my SilverlightClientService returns plain data, such as a string, it works quite well.
The moment, however, that I change SilverlightClientService to call BackEndService, I get the following exception:
HTTP 415 - "The request failed with HTTP status 415: Unsupported Media Type."
I had an issue with 2 services not communicating. We finally figured out that using Cassini (the built in Visual Studio IIS) to host the ListenerService 'BackEnd' was causing the problem. Switching the project to start in a virtual directory of IIS allowed the two to communicate.
I was seeing : An error occurred while receiving the HTTP response to http://localhost:1484/MainListenerService.cs. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details. and this error:
The HTTP request was forbidden with client authentication scheme 'Anonymous'.
Are you using basicHttpBinding? Silverlight only supports basicHttpBinding but the default when you create a WCF service is wsHttpBinding. You should change that on your web.config before adding the reference on your Silverlight project. Check out this video from Tim Heuer: http://silverlight.net/learn/videos/all/how-to-consume-wcf-and-aspnet-web-services-in-silverlight/

WCF Routing Message Security

I'm building some routing functionality between services. The original service and the service that does the routing have an identical configuration; both are using netTcpBinding with the following binding configuration:
netTcpBinding
security mode="Message"
message clientCredentialType="UserName"
The service behavior uses a AspNet Membership Provider and a client certificate we've installed on the machine.
When I switch off the message security it relays just fine but when it's switched on I get the following exception:
"The message could not be processed. This is most likely because the action 'http://foo/Whatever' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings*. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding." (Emphasis mine)
My thinking is that the certificate is operating on the message twice (once on the original call and then on the relay) and this is what corrupts the message's security token.
Questions:
Is my thinking on target?
Is there a way to continue to use message security for routing without having the complexity of a token service?
You mentioned switching between no security and message security. Are you making sure to change both the WCF service endpoints as well as the endpoint on the receiving end? If not, and the two do not match up, you will receive an error. That's what that error seems to be saying to me.
For Question 2, what type of environment are you running in? A closed system where you could use encrypt and sign, or a public environment, where you might need to be using a special key?