I have a Coherence cluster running on my local machine, and a C# application that is trying to connect to it. I am getting the error:
Could not establish a connection to one of the following addresses:
XXXX. Make sure the remote addresses element contains the IP address
and port of a running TcpAcceptor.
Here is the remote addresses section of my client config:
<socket-address>
<address>localhost</address>
<port>9099</port>
</socket-address>
I can't connect to this address or any of our other environments, which are working for other existing code. I confirmed that the cluster was running using a Coherence Console node. What are some possible causes other than the obvious incorrect IP address? What else can go wrong?
Is it possible to confirm that a "running TcpAcceptor" is on my machine?
Before I added the config file, it threw an exception saying that it was missing cache-config.xml. All our other code uses coherence-cache-config.xml instead; is this important?
Issue resolved. The problem: although I had coherence.xml and cache-config.xml in the project and they were being used, I was missing the POF config. I added a coherence section to my app.config explicitly referencing these files and it worked.
check if local-config.xml in your proxy node defined properly.
<tcp-acceptor>
<local-address>
<address>localhost</address>
<port>9099</port>
</local-address>
<suspect-buffer-size>1000000000</suspect-buffer-size>
</tcp-acceptor>
Related
I've looked up several articles/sources but none of them helped me out.
I have this bizarre issue where i can only connect to my SignalR Server (Self-Hosted, same computer) if the Server itself is configured to run on http://127.0.0.1:8765 and the Client is pointed to that same address. However, if i change the Server to run on any IP such as http://*:8765 and the Client is pointed it to my IP or computername, say: http://192.168.0.1:8765 or http://MyLocalPC:8765, the client throws an Exception after await _hubConnection.Start() with message: No connection could be made because the target machine actively refused it 192.168.0.1:8765.
i have tried below steps to experiment a little but none of them actually helped:
changed the port from :8765 to any port i can think of (that is obviously not occupied), didn't work.
changed from one Network to another, didn't help.
disabled firewall on both Server and Client computer, nope.
tried to run the Client on another computer, same error message.
to show a snippet of the code, see below:
Server (_signalR is an IDisposable object & _serverURI is where http://____:__ is specified):
Client (_hubConnection & _hostAddress is self-explanatory):
i am using C# 7.0 with Microsoft.AspNet.SignalR.Client 2.4.1.0 and Microsoft.AspNet.SignalR.Core 2.4.1.0
i just realized that its because Visual Studio wasn't running with Administrator rights. SignalR required administrative rights to able to run its Server on IPs other than localhost or 127.0.0.1. I wasn't able to fully realize it since i switch laptops about 3 weeks now and forgot setting up running Visual Studio in Administrator Mode.
The reason i was also not able to find any error regarding that is for some reason there's a flaw in my code where i suppressed the exception error and still displayed a message as if it was working properly.
I'm trying to setup my local nCache development. In my ASP.net code, I'm calling the following:
Cache cache = NCache.InitializeCache("local-test");
However, it is throwing an OperationFailedException:
No server is available to process the request for local-test
Any idea why? The documentation says that this error typically relates to firewall issues, but I'm running this thing locally.
Configuration
In %NCHOME%\config\client.ncconf, the cache is identified:
<cache id="local-test" client-cache-id="" client-cache-syncmode="optimistic" default-readthru-provider="" default-writethru-provider="" load-balance="True">
<server name="My IP address"/>
</cache>
...and config.ncconf has the following definition:
<cache-config name="local-test" inproc="False" config-id="0" last-modified="" type="local-cache" auto-start="False">
<log enabled="True" trace-errors="True" trace-notices="False" trace-warnings="False" trace-debug="False"/>
<perf-counters enabled="True"/>
<compression enabled="False" threshold="100kb"/>
<notifications item-remove="False" item-add="False" item-update="False" cache-clear="False"/>
<cleanup interval="15sec"/>
<storage type="heap" cache-size="250mb"/>
<eviction-policy enabled="True" default-priority="normal" policy="lru" eviction-ratio="5%"/>
</cache-config>
I am listing down some the reasons for this exception to be raised.
• This error is sometimes thrown when the Cache you are trying to connect is stopped on the machine
You can verify this by running the 'Get-Caches' cmdlet from PowerShell. If it is not currently running on this machine, you can start the Cache by using the 'Start-Cache' cmdlet from PowerShell.
PowerShell Guide: http://www.alachisoft.com/resources/docs/ncache/powershell-ref/
• When an application tries to connect to the Cache, the IPs where the Cache is hosted are checked through the Client.ncconf file ("C:\Program Files\NCache\config\client.ncconf"). If the IPs that are mentioned are wrong, your call may go to a completely different server where either cache is not running or service is not accessible at all.
You can review that the IP configured against the Cache in the Client.ncconf is the same as what you have currently running on the box. So for example if your IP is '192.16.1.1' then your Cache's client.ncconf tag should look something like this.
<cache id="mycache" client-cache-id="" client-cache-syncmode="optimistic" default-readthru-provider="" default-writethru-provider="" load-balance="False" enable-client-logs="False" log-level="error">
<server name="192.16.1.1"/></cache>
This IP should be the same as the one that is configured in the NCache Service configuration file.
• If the machine has dual IPs and the NCache Service is running on a different IP (than the one where the Cache is hosted or configured to host) then your application may also get this error.
Please make sure that your NCache Service is currently running on the correct IP as well. Please check the value against the following tags in the NCache Service Configuration file (C:\Program Files\NCache\bin\service\Alachisoft.NCache.Service.exe.config)
<add key="NCacheServer.BindToClusterIP" value=" xx.xx.xx.xx "/>
<add key="NCacheServer.BindToClientServerIP" value="xx.xx.xx.xx"/>
Please make sure that this is the same IP as the one configured in the Client.ncconf file.
• This error could also be thrown in such a scenario where there is a firewall enabled on the machine, it could be denying the access to the ports on which the Cache host process is running. .
Please make sure that the Cache Ports are opened in the Firewall, if the firewall is enabled. You can verify the Cache's Port from this file "C:\Program Files\NCache\bin\service\CacheHostPorts.xml". If this still doesn't work, please disable the firewall completely and check.
I had an old version of the NCache libraries installed. When I upgraded the client DLLs, everything started working.
I am working on a 'Smart Device Project' using .Net Framework 3.5. I am trying to connect to some Java SOAP services on a remote server.
In order to do that, I added 'Web References' to my project.
When I try to call my web service I get a WebException 'Unable to connect to the remote server' with the inner exception being 'No connection could be made because the target machine actively refused it'.
I searched quite a lot on the Web and StackOverflow and found a lot of ASP configuration and 'Unavaliable port' answers, but as I have another application using the exact same Service successfully, I can't get why the new one isn't getting through (It did sometimes through my tests so I suppose my client implementation isn't that bad)
I tried to look if there was some connection issue on the port by using some TcpClient:
System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient();
try
{
client.Connect("myServerName", 8087);
MessageBox.Show("Success");
} catch (Exception ex)
{
MessageBox.Show("Failure");
}
finally
{
client.Close();
}
This connection succeed.
Here is a sample on how I call my WebService:
WSServiceExtended srv = new WSServiceExtended();
srv.Proxy = new System.Net.WebProxy();
ServeurWSI wsi = new ServeurWSI();
srv.Url = "http://myServerName:8087/myServerApp/services/myService";
wsr = srv.login(wsi);
The service is called 'Extended' because I overrided the auto-generated one in order to add Cookie managment since I am using the Compact Framework. Following the sample in this thread:
https://social.msdn.microsoft.com/Forums/en-US/34d88228-0b68-4fda-a8cd-58efe6b47958/no-cookies-sessionstate-in-compact-framework?forum=vssmartdevicesvbcs
EDIT:
I made some new tests with the Web references and got it to work.
When I add the Web Reference, I have to put some Url to the Web Service. When I set it with the actual hostname instead of the 'localhost' everything is fine.
But then, since I set it manually to the real address just before the call, it shouldn't matter
srv.Url = "http://myServerName:8087/myServerApp/services/myService";
EDIT2:
I might have forgotten some specifics about my environnement.
The Web Services are exposed on my computer on some Tomcat Server.
The application I am working on is also developped on this computer (That's why I can add Web References by putting 'localhost' in the address)
The application is then deployed on a distant device (Windows CE) that will make calls the Web Services through WIFI (There, localhost wouldn't work then)
I tried calling the Web services from other computers successfully.
I'm beginning to think that there might be some differential between the called Url and the one that is set, otherwise, how would I have a difference in behaviour such as the one described in the first edit?
EDIT3:
Well..Seems like it's not a network issue but a .Net compact framework (usage?) issue...
The Url property of the Web Service implementation is simply ignored and the one in the Reference.cs is used in place.
If someone had some idea on how I could troubleshot this, I would really appreciate it.
That error means that you reached a server and the server said "no way". So you're either hitting the wrong server or the wrong port.
I find the telnet client is useful for testing stuff like this. From the command line, you can do:
telnet [servername] [port]
So something like:
telnet myServerName 8087
If it goes to a blank screen, then it connected successfully. If it does not connect, it'll tell you.
The telnet client is no longer installed by default in Windows 7+, so you'll have to install it. See here for instructions: https://technet.microsoft.com/en-ca/library/cc771275
If the connection does open, you could paste in an actual HTTP request to see what happens. A simple GET would look something like this:
GET /myServerApp/services/myService HTTP/1.1
Host: myServerName:8087
One reason for this error can be that the service binds to only a certain IP address. It could well be that the service only listens on the IP that is assigned to the host name, but not on the localhost IP (127.0.0.1).
For example:
If the host myServerName has the public IP 192.168.0.1, your service can choose to listen on all IPs assigned to the host (sometimes specifying 0.0.0.0), or it can specifically listen on 192.168.0.1 only. In that case you will not be able to connect through 127.0.0.1, because the service simply doesn't listen on that IP.
You can "use" this inverse of this feature to make a service accessible only to local clients, not on the public IP-Address, by listening on 127.0.0.1 only, but not on the public IP. This is sometimes used on Linux for example to make MySQL only accessible on the host itself.
I was starting to forget this post but I finally found the problem that was messing things up and it has nothing to do with programmation.
I was doing the calls while the device was connected to the computer via the 'Windows Mobile Device Center' allowing to access the device from Windows.
While connected, the host provided is ignored and all calls on the specified port are handled by the connected computer.
Disconnecting the device allows to communicate properly...
I'm try to use t32apinet.dll on host V (Win7 embedded 32bit) to connect with host W (Win 7 64bit).
TRACE32 on host W is already configured in config.t32 to accept a connection:
; Remote Control Access
RCL=NETASSIST
PORT=20000
PACKLEN=1024
TRACE32 is running on W while I try to config the driver and to establish the connection from V as follows:
T32 = new T32API();
T32.Config("NODE=", "192.168.100.2");//all Config returns 0 (no errors)
T32.Config("PACKLEN=", "1024");
T32.Config("PORT=", "20000");
T32.Init();//returns -1
//T32.Attach((int) T32API.Device.ICD);
On W I see incoming packages on port 20000 when Init() is executed on V.
Any ideas why Init() return with error?
Additional info regarding comments bellow:
I'm using T32Start-Tool to start Trace32, where using of API Port is activated and port value: 20000 is set
calling t32remtest.exe 192.168.100.2 port=20000 on remote PC returns:
error initializing TRACE32
error initializing TRACE32
The minimum viable settings block for enabling the Remote API port of TRACE32 in your configuration file is:
RCL=NETASSIST
PORT=20000
Please make sure to include an empty line before and after the block and that the correct TRACE32 configuration file is selected during start-up.
If you are using the T32Start utility to start TRACE32, the configuration file gets dynamically generated and is not necessarily identical with the default one config.t32.
although I saw the incoming packages in the sniffer there was no reactions from TRACE32.
The problem was that Windows recognized that network as public and blocked packages on the application level. Due to specific local IT policies the solution for me is to create a rule in windows firewall to explicitly allow communication on UDP port 20000:
screen with settings for new inbound rule in Win firewall
I am trying to get the hostname by passing in the ip address. I use the following code.
System.Net.Dns.GetHostEntry("192.168.x.x").HostName
For some host the above code is returning correctly the hostname, but for few other host it throws an exception 'No Such host found'.
Could any one tell me why is this happening for some hosts?
I used the above code in an asp.net mvc application.
Not all IP's are setup properly with a reverse DNS entry. These IP's are typically end consumers on lazy ISP's who don't provide PTR records for their clients. If there's no reverse entry, you can bet there's no forward entry either. As such, these hosts have no hostname at all, hence the exception. You'll need to catch this exception for these hosts and use something else such as their IP as an identifier.
I'm using Dns.GetHostByAddress, even though it complains about being depreciated. (VS2010 targeting 3.5)
Dns.GetHostEntry seems to throw an exception if a the target host is not reachable even if DNS knows the hostname. There doesn't seem to be any .NET way around this except for using depreciated methods. :\
(edit: though the above answer is also true - some machines just don't have hostnames. my answer is just if you know it should have a hostname but GetHostEntry doesn't work)