Using WebSocket on Windows 7 - websocket

I just installed Visual Studio 2012 RC and tried to run a service with netHttpBinding enabling WebSocket and get the following error:
This platform does not support server side WebSockets.
The sample I am running is from http://blogs.microsoft.co.il/blogs/idof/archive/2012/03/01/what-s-new-in-wcf-4-5-websocket-support-part-1-of-2.aspx
Can WebSockets work on Windows 7 with Visual Studio 2012 RC?

No, websockets is only natively supported by Windows in Windows 8, regardless of which visual studio version you are using.
http://www.paulbatum.com/2011/09/getting-started-with-websockets-in.html
This is due to some low level issues in Windows 7 with http.sys.
There's an offchance it may be backported, but seems unlikely: http://weblogs.asp.net/owscott/archive/2012/03/01/what-s-new-in-iis-8.aspx
To use websockets on Windows 7, you'll have to write your own service.
Try using this for clientside: http://websocket4net.codeplex.com/
and this for server side: http://superwebsocket.codeplex.com/

I ran into the same problem and solved it by using Fleck. Trivially simple to implement:
One. NuGet add Fleck reference
Two. Create your webserver socket
// Create Websocket server
websocketServer = new Fleck.WebSocketServer("ws://localhost:82");
websocketServer.Start(socket =>
{
socket.OnOpen = () => Console.WriteLine("Open!");
socket.OnClose = () => Console.WriteLine("Close!");
socket.OnMessage = message => socket.Send(message);
});
I now have a a ASP.NET Self Host web API on one port and the websockets connection running along side it.

Related

Visual Studio Windows Form Adding Web Service Reference Error: Could not create SSL/TLS secure channel

Im trying to add wsdl web service in windows form application to connect a web service. It gives error of
"The request was aborted: Could not create SSL/TLS secure channel."
here is the screenshot regarding the issue:
I checked the similar questions but they didnt help. How can i get out this issue. im using Windows 10, Visual Studio 2013
Any help is appreciated.

cpprestsdk SSL post not working on Windows7 but works on windows 10

I have a C++ Windows application, developed using Visual studio 2017 on windows 10 system. This application uses cpprestsdk to post request to REST Server. My application works perfectly fine on windows 10 machine with properly posting request over ssl to rest server. I did not create any local certificate to make my application work on windows 10.
However same application when ported on windows 7 (64 bit), is not able to POST request with SSL protocol to rest server.
Same request works without SSL, (http://HOST/API works)
but (https://host/api fails)
by giving following error.
winhttpsendrequest 12029 a connection with the server could not be established.
From same windows 7, PostMan can successfully post https request.
No clue of what could be wrong with the implementation.
Can any one share what could be the reason of failing the POST request on windows 7?
I'm a bit late with the answer but I hope that it might help others who face the same problem ...
I think that your server insists on using tls version higher than 1.0 which is a default on Windows 7. Unfortunately cpprestsdk cannot be configured to use a specific tls version. On Windows cpprestsdk uses WinHTTP which exposes two handles but only one of them can be used to configure tls (I do not remember handle names at the moment). Unfortunately the native handle that cpprestsdk has access to cannot be used to configure tls.
The only workaround is to configure Windows 7 (and indirectly WinHTTP) to use a specific tls version as default. Instructions on how to do that can be found here: https://support.microsoft.com/en-ca/help/3140245/update-to-enable-tls-1-1-and-tls-1-2-as-default-secure-protocols-in-wi.

Cordova + Win10 + WebSocket: connection fails with SECURITY_ERR

I'm porting an existing Cordova app from Android to Windows 10. The app must open a WebSocket connection to a remote server. At the moment, the connection always fails with the error "WebSocket Error: SECURITY_ERR, Cross zone connection not allowed". The same app is also making regular AJAX requests to the same server and they're working fine.
I'm using Visual Studio 2017 and testing the app locally, using Edge/13.10586.
Is it possible to make the WebSocket connection to work?
UPDATE
My app has both "Internet (Client)" and "Private Networks (Client & Server)" capabilities set. Further tests show that the problem is caused by the combination of web context ("ms-appx-web:") and attempting to connect the WebSocket to a non-FQDN (I'm using only the hostname). If I use FQDN or the IP address instead, it works. If I use local context ("ms-appx:") instead, with non-FQDN, it works.

Windows service needs too long to start, timeout reached

I have created one service with following build env:
OS : Windows Server 2012
IDE: Visual Studio 2012
Arch: x64
Same service is working fine with Windows Server 2012 but The same service is not starting in Windows Server 2008.
OS : Windows Server 2008 R2
Arch : x64
I am getting following error in Event Viewer
A timeout was reached (30000 milliseconds) while waiting for the service to connect.
Note : I have installed all the necessary VC++ redistributable package needed.
Your Service needs to long to start on the Windows Server 2008 machine. If the timeout is exceeded the service will be stopped. This could be due to different reasons like the following:
slower hardware
slower network connection
different workload
...
I would recommend to create a worker Thread in the starting method of the service. This avoids the Timeout.
protected override void OnStart(string[] args)
{
// Create working thread
Thread serviceThread = new Thread(() =>
{
// do stuff
});
// start thread
serviceThread.Start();
}

how to connect windows phone emulator to local server

I Want just to know how
How we can do to access the OpenERP server (on localhost) via a Json request using windows phone application (emulator)?
how to connect to a local server = (localhost access) because I think there is no relationship between my application and the local server
For connect to OpenErp from Visual Studio for Windows Phone, I use XmlRcp
http://xml-rpc.net/index.html
It's simple use and fast developing.
Regards

Resources