Web Socket server stops working on IIS - wcf

I have server on my IIS that contains WCF Service "MyService.svc" which works with net.tcp protocol and generic handler (Device.ashx file, which works with web socket connection). My desktop app is a client that connects to "MyService.svc" by net.tcp protocol. Also i have mobile apps which connects to Device.ashx by websocket protocol. Everything seems good but i have one problem. After some time mobile apps can't connect to the server, but desktop app working good. Should I look for problem in IIS settings or in my code?

Related

Calling a net.tcp wcf service from Silverlight - in an external facing web site?

I have an external (public) website developed in Silverlight. The Silverlight app currently calls http based wcf services hosted in IIS.
I am now having to call a wcf service with net.tcp binding hosted in a different app server. I have the net.tcp wcf service hosted in a windows service on port range 4502-4530 and with an interface to expose clientaccesspolicy.xml file as part of the service. I am able to invoke this service from my Silverlight app in the web server. I want the SL app to make direct call to net.tcp, rather than routing the call to it from another http based service.
Question is will this work without any issues when exposed over internet.
Client browser --> IIS webserver with Silverlight website --> App Server with wcf service on net.tcp.
I am assuming in this case, from XAP SL would try to make direct call to the app server service using net.tcp ?
The communication between the web server and app server could be opened up for ports 4502-4535. But I am wondering what about the client. Does this setup require the ports to be available even in the clients machine (with browser)?
Any insight is much helpful.
Thanks.
Take a look at http://support.microsoft.com/kb/2425652; there is sample code included as well! If you setup clientaccesspolicy.xml correctly; it should work as long as clients can access your TCP server.
If your clients are behind some firewall which is blocking your server's ports; they may face connectivity issues!

how to redirect SignalR Request to another Machine

I have many clients connected to a server in SignalR
but I want the server to redirect or route all of the Requests to another server , and to route the response to the clients in the same way used in WCF routing service so how can we do this on SignalR ,please ?
To be more specific
I have a server with a web app published on internet
some of the clients Devices cannot connect to the internet
I need to connect them to the server via an intermediate machine connected to the internet.
The client can connect to this machine and the machine connect to the internet then to the main server.
I used WCF routing services to do it for WCF
but what is the technique for SignalR ?
thanks
You can make each of your SignalR machines individually addressable and then have a single machine manage which clients should connect to which SignalR servers.
Each client could make an Ajax request to the management machine which could then respond with the URL the client should establish a SignalR connection to.
If you need clients on separate machines to be able to communicate with each other using SignalR, you should look into SignalR's scaleout providers: http://www.asp.net/signalr/overview/signalr-20/performance-and-scaling/scaleout-in-signalr
As indicated by the first diagram in the previous link, you can put your SignalR servers behind a dumb load balancer if you decide to use a scaleout backplane.

WCF Web socket client also need to run on windows 8

I am new to WCF web socket and I am trying to implement duplex service using web socket. I have implemented the wcf web socket service using the following example and it works fine.
http://msdn.microsoft.com/en-us/library/hh977020.aspx
I know the minimum requirement for WCF service for web socket is windows 8 and .net framework 4.5. So I have hosted my service on windows server 2012 server machine.
Then I have written WCF web socket client to access the service and my client is windows
form applications runs on windows 7. I got the following error.
“This platform does not support client side WebSockets natively.
Support for client side WebSockets can be enabled on this platform by
providing an implementation of
System.ServiceModel.Channels.ClientWebSocketFactory.”
Does web service client also need to have windows 8? If it needs are there any third party libraries to access WCF web socket service.
Really appreciate your reply.
You will need win8 or 2012server to be able to use the Microsoft WebSocket namespace in your WCF. You could also take a look at SignalR that will fallback to other techniques when WebSockets is not available.
You can also use XSockets.NET that will run websockets on .NET 4 (so there is no need for win8 or 2012server).
You also have SuperWebSocket and Fleck as options of .NET 4.
Edit: Added sample with WebSockets from WCF .NET 4 here https://github.com/XSockets/XVA/tree/master/XVA-07-02-BoostWCF/Any%20OS

Web Services only connecting to Trusted Devices

I am on a project that uses web services to communicate with hand held devices (Symbol MC70s running windows mobile 5).
We need to make sure that others on the internet can't connect to the web services and start sending info.
I have made a certificate so that the hand held will only connect to my services, but I don't know how to make sure that my services will only connect to my hand held devices.
My app is coded in the .NET Compact Framework and I am using Visual Studio 2008 SP1. My services are hosted in IIS and are coded with WCF in C# (.NET 3.5 sp1).
Any ideas?
Password-protect the services. Alternatively, authenticate the client by the client SSL certificate and issue those to your users.
No way to lock access down to a specific device. A device can be spoofed fairly easily.
When you say that you've "... made a certificate so that the hand held will only connect to my services", are you saying that the device uses https to the web service or that the device is locked down to only connect to the web service http URL?
Anyway, if you are concerned about the data pulled from the web service, you could encrypt it with a key known to your device.

Accessing WCF Service using TCP from the DMZ (not on network or domain)

We have a DMZ where we host an IIS website which in turn communicates to our "app" server (also IIS) WCF services using TCP.
When we are on the domain and in the network this works fine. When we try to access the services from the DMZ we get a "cannot handle anonymous" user exception. Accessing the app server directly works fine.
Any suggestions on the best way to configure the security between the DMZ and the app server?
Thanks.
KJQ
netTcpBinding default to using Windows credentials so a different AD domain will not work. In a case like this using a mutual certificate is good option to validate between the DMZ and the actual service.