I'm writing a web socket application which I intend on hosting on the cloud using an Azure web app.
The web socket is implemented using a fairly standard piece of Owin Middleware and is fully functional for the first 100 seconds. After this time the websocket seems to enter the aborted state like clockwork.
[CLIENT][06/04/2018 11:27:21] WS client connected
[CLIENT][06/04/2018 11:29:01] WS client disconnected
Trying this on an IIS Express instance gives the same issue, although the delay seems to be 90 seconds rather than 100 (this is also consistent).
Running the same websocket as part of an Owin self-host app yields stability for over 25 minutes - so this definitely seems to be a problem caused by the hosting server.
On the azure web app hosting I've enabled web sockets, and also tried to enable the "Always On" feature in hopes that this would prevent the issue by preventing the server from going into a standby state - but this has not helped.
Are there any azure settings that I'm not aware of that could be tweaked such that these web sockets can stay open for longer periods of time?
Many thanks
Unfortunately, it seems that azure and IIS were both red herrings, the issue instead was an issue experienced with using the C# implementation of System.Net.Websockets.ClientWebSocket. The detail is brilliantly summarized at: .NET WebSockets forcibly closed despite keep-alive and activity on the connection
To others experiencing this issue, an effective (but not ideal) work around is to run the following once before creating a client web socket:
ServicePointManager.MaxServicePointIdleTime = int.MaxValue;
Related
Good morning,
I have a WCF service using the following technologies:
.Net 4.7.2
Castle Windsor + WcfIntegration Package
IIS 10
Visual Studio 22
Originally I asked a question relating to some Azure App Insights anomalies I was seeing that can be found here: Azure App Insights Question
I am now able to replicate the behaviour I was seeing that proves the Wcf Service is queueing the requests. I have a test harness that uses multi threading to send off a specified number of requests at once. If I fire off 100 requests and then an additional 5 from different machines, the 5 won't be returned until the 100 has finished. I believe this is on the connectivity to the service and not anything the service is doing. To prove this I created a blank method with a Sleep 100ms on it that then returned a blank memory stream. The above behaviour still occurred.
It's my understanding that WCF accepts Concurrent calls by default so I find the behaviour bizarre and hoping someone might have some information on configuration/settings I can try.
Thanks in advance.
this is my first questions on SO. Normaly I just wander the internet reading stuff until I can make up a solution.
So up until now we use HTTP Request and Response Model to communicate with Clients.
Using C# ASP.Net .Net Framework 4.0 hosted in IIS.
This way we are not able to forward information in real time to them from the server.
We would need to wait till the clients contact the server.
To solve this issue I think OWIN with SignalR V2 Middleware hosted in IIS would give us the ability to use Remote Procedure Calls, so whenever something happens that needs to be forwarded immediately to the Client, we can do so by calling that specific clients function or all clients.
For this of course the target Framework of the application needs to be .Net Framework 4.5 at least.
Now the problem I have is that in the Microsoft Documentation it says to use the IIS Express version, in order to enable the server to have more than 10 connections.
On the client side it would be no problem as ideally there would only be one connection at any given time.
But the Server should be able to have a whole lot more than just 10. As the Websocketconnections would stay open.
I am not an IIS expert, but why are there these limitations in the non Express version?
I would expect that one should be able to set the number of maximum connections despite the IIS version?
What are the gains of using IIS instead of self-hosting OWIN?
I would guess that I would need to implement some security features myself?
On my development PC a client Windows Service with SignalR V2 is able to communicate with an OWIN SignalR V2 hosted in IIS application.
At the moment I need to evaluate what needs to be considered to set this up on a server to ensure functionality.
I hope this all makes sense.
I am implementing Remote Procedure Calls in our Webservice, for real time communication with clients.
I read documentations about RPC, SignalR V2, OWIN and Katana.
At the moment I need to evaluate what needs to be considered to set this up on a server to ensure functionality.
I have a Xamarin app that connects to a SignalR server hosted on Azure.
Since it's Xamarin running over mono, websockets are not available.
When my server was hosted on Azure Mobile Services, the app used SSE.
I moved the server to a web role because mobile services were too limited.
Now my app fails to connect using SSE and falls back to long polling after the 5 seconds timeout interval.
I tried creating a new Web Role and only adding SignalR. Still get the same problem.
I have identified/tried the following:
It looks like the SSE request is being buffered somewhere in Azure. If I use a proxy I can see the request but the first response byte is received only after SignalR times out and closes the connection.
There is no proxy or similar on my network - I can still connect over SSE to my old mobile services server.
I turned on tracing on the server and it looks like SignalR is doing its thing - it returns the response to the SSE connect request.
I can also see the SSE request in IIS in the AuthorizeRequest stage which means the connection is opened.
I disabled dynamic compression. Didn't help.
To summarize, looks like the SSE connection is made, remains open, but something prevents the data from SignalR from reaching the client.
I read here that this can be an issue with the Http Platform Handler. But as far as I understand, this is not relevant to web role since it's normal C# code running in IIS.
Try using HTTPS - it will prevent proxies from messing with the event stream.
Please excuse my lack of experience, I'm not sure where to begin, I'm googling my self in circles.
Would it be possible to create a socket server (c#) console application and host it on a goDaddy shared hosting account. I'm trying to create a server/client application but I'm stuck with a shared hosting account from goDaddy.
Also, is there a significant difference between sockets and webSockets?
If you could point me in the right direction, or at the very least let me know if its even possible...?
EDIT:
I have a WPF application running of a windows surface tablets (3 tablets), the application is for time tracking, it gives people the ability to login / logout using an RFID reader. For the backend I'm using Web API and the issue is latency. It sometimes takes up to 15 seconds for the application to create a connection, authenticate (if not authenticated) and get the person's status.
Needless to say staff are impatient and I see their point (they should be able to swipe, confirm and walk away), I'd like to be under 2 seconds max. So I figured if I can keep a connection open through-out operating hours (sockets), then fetching a user's status should be near instantaneous.
I'm open to any suggestion/recommendation. I can't thank you enough! Thnx a million!
Without getting into some rather hinkey maneuvers that would probably get your account shut down you would be very hard pressed to run a socket server on godaddy shared hosting. Mechanically you'd need to be able to execute a custom .exe which would need to be executed -- and kept executing -- by something somewhere. This executable would also need to listen on a particular TCP port which would most likely be either in use like ports 80 and 443 or would likely be firewalled from the rest of the world.
Hosting a web socket app would be tricky -- first they would need to have ugraded to IIS 8 and cursory tests indicate they are still on IIS 7.5. Second, they would need to permit websocket usage which is not something likely to be enabled on shared hosts. I think resource usage would be a challenge if you managed to run these two traps.
It would help quite a bit to understand what you are doing but if it is something that requires either sockets or even web sockets you are looking at a class of hosting above the godaddy shared options.
I have a .NET MVC 4 web app that uses MassTransit with MSMQ. We have several legacy apps that use MSMQ, so I'm constrained to that protocol. My client code in Application_Start() in my global.asax.cs file looks like this:
Bus.Initialize(sbc =>
{
sbc.UseMsmq(a => a.UseSubscriptionService("msmq://localhost/mt_subscriptions"));
sbc.ReceiveFrom("msmq://localhost/webconsole?tx=false&recoverable=false");
sbc.UseControlBus();
sbc.UseBinarySerializer();
});
I'm running this app on a Windows 8.1 developer box, and this call completes successfully & communications work as expected when I run it on IIS 8.5. However, when I run it on IIS Express 8.0, the call never completes and will eventually throw a timeout error. I found the following in the IIS Express FAQ:
Q: Does IIS Express support non-HTTP protocols such as net.tcp or MSMQ?
A: No. IIS Express only supports HTTP and HTTPS as its protocol.
Ok, fair enough, but I don't understand what the web server has to do with MSMQ (aside from using MSMQ over HTTP, which I am not attempting to do); I don't have any "msmq://" routes or anything like that. Doesn't MassTransit use MSMQ directly without going through the web server? And I can't believe that I'm the only developer out there who develops on IIS Express with MassTransit.
Any insights as to what is going on here? Thanks!
So I did finally figure this out, I thought I would post the answer to perhaps save someone else from banging their head against this particular wall. During startup, MassTransit looks to see if Windows Performance Counters are available. For some reason, checking for their existence when running on IIS Express results in a hung call. You can find an entire discussion thread on the subject here, it's also been an issue for SignalR and Windsor Castle developers: https://groups.google.com/forum/#!topic/masstransit-discuss/Pz7ttS7niGQ. As a result of the discussion, the MassTransit developers added a DisablePerformanceCounters() method to their API, and calling that method when creating the service bus fixed my problem.