Selenium WebDriver Socket Exception - c#

Everything was working fine till yesterday and from today onward , I have started facing the issue intermittently at any stage but frequently
{"Unexpected error. System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted 127.0.0.1:21235\r\n at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)\r\n at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)\r\n --- End of inner exception stack trace ---\r\n at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)\r\n at System.Net.HttpWebRequest.GetRequestStream()\r\n at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)\r\n at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)\r\n at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)\r\n at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)"}
I have already tried basic stuffs, like see if port is not in use already or bind to someone, but that doesn't seem to be the issue.
Not sure, what's wrong, anybody else has any idea or have faced something similar then please help me out here
Thanks in Advance

Related

Operation was attempted on a nonexistent network connection error

In my C# SignalR project, Facing the internal socket error during the hubconnection dispose and sometimes the code wont run, showing the exception provided below and also after the first execution , will be running fine for sometime. Is there anything that need to be done along with the hubconnection disposal or how the hubconnection disposal can be achieved properly so that this problem won't be recurring?
System.AggregateException: One or more errors occurred.
System.Net.Http.HttpRequestException: An error occurred while sending the request.
System.Net.WebException: Unable to connect to the remote server
System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it.
Stack Trace:
Socket.InternalEndConnect(IAsyncResult asyncResult)
Socket.EndConnect(IAsyncResult asyncResult)
ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---
HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
HttpClientHandler.GetResponseCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
Task.Wait()

SignalR connection issue with a server

So I recently bought a vps to try SignalR in my project, I used this example : Simple SignalR Project
Unfortunately though I do not have any experience with such things, I uploaded the ServerSide program on my vps and tried to connect with it, but I get the following error : An error occurred while sending the request.
More Detailed :
System.Net.Http.HttpRequestException' in mscorlib.dll
System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: 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 ip:9080
at System.Net.Sockets.Socket.InternalEndConnect(IAsyncResult asyncResult)
at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar) / System.Net.Sockets.SocketException (0x80004005): 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 ip:9080
at System.Net.Sockets.Socket.InternalEndConnect(IAsyncResult asyncResult)
at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
So I was wondering if I'm doing anything wrong here, or need to do any specific settings/setups on my server
by the way my goal is to have a connection with a server and get real-time data for my project, so if there's any better alternatives, would appreciate suggestions
well, found the solution, my firewall was preventing the connection

adding reference for wsdl service in windows service and using its function in c#

I have a windows service using C#(windows application) which performs a set of various functions.
But recently it was required to use a wsdl service (a url was provided) whose functions I have to use in my code.
Although I have never done it before but if I am not wrong we add the service reference creates its instance and then call its function.
I have done all these successfully.
But when i execute the service I get end point not found exception something like as below..
System.ServiceModel.EndpointNotFoundException: Could not connect to http://localhost:8082/quali-jaxrpc/quali. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8082. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:8082
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
at System.Net.HttpWebRequest.GetRequestStream()
at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()
--- End of inner exception stack trace ---
The problem is that the service is already running on the server itself but yet it is giving this exception..
Am I doing something wrong?
Please note that my service is not WCF its windows service.
When I added the service reference of the WSDL in appconfig following was created-
<endpoint address="http://localhost:8082/qualicision-jaxrpc/qualicision"
So i just replaced the localhost with the IP of the server.
Although the service is deployed on the server and windows service also running on same but still adding actual IP of the server in place of localhost worked.

No connection could be made because the target machine actively refused it [::1]:59780

I faced with problem of running several automated tests successive.
When I run tests separately all works great, but if I run multiple tests simultaneously I get this error on second test (first is passed):
Result Message:
Test method IAM.DashboardTests.Tests.ChromeWizardTests.CheckAppsUsedByCoworkersChrome threw exception:
OpenQA.Selenium.WebDriverException: Unexpected error. System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it [::1]:59780
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
at System.Net.HttpWebRequest.GetRequestStream()
at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
Note: tests are running on my machine, I don't use any remote machines.
All tests are placed in one class and it contains TestInitialize (MSTest annotation) with running driver and browser:
private void ChooseBrowser(String browser)
{
if (driver == null)
{
if ("firefox".Equals(browser))
{
driver = new FirefoxDriver();
}
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(30));
and TestCleanup with browser stopping:
public void Stop()
{
driver.Quit();
driver = null;
}
By the way, browser opens in second tests and goes to login page but after that error occurs. I mean that physically browser exists, but tests can interact with him.
Reproduced in Chrome and Firefox on Windows8.
Please, let me some advice, I cannot beat this problem alone.

WebException: Unable to connect to the remote server

I have a client application that uses WebHttpRequest to get response from external server, it works fine but some times I'm getting the following exception ....
System.Net.WebException: Unable to
connect to the remote server --->
System.Net.Sockets.SocketException: 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
xx.xx.xxx.xxx:xxx at
System.Net.Sockets.Socket.DoConnect(EndPoint
endPointSnapshot, SocketAddress
socketAddress) at
System.Net.Sockets.Socket.InternalConnect(EndPoint
remoteEP) at
System.Net.ServicePoint.ConnectSocketInternal(Boolean
connectFailure, Socket s4, Socket s6,
Socket& socket, IPAddress& address,
ConnectSocketState state, IAsyncResult
asyncResult, Int32 timeout, Exception&
exception) --- End of inner
exception stack trace ---
at
System.Net.HttpWebRequest.GetRequestStream(TransportContext&
context)
at
System.Net.HttpWebRequest.GetRequestStream()
.... Any help?
This is more of a "Request Timed Out" error. The server you are trying to connect to did not respond to your request. You should handle this exception using try-catch and attempt to connect n number of times again in the catch block.

Categories