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.
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 have a dotnet core application that tries to access to the database, when I run it in visual studio it works fine (probably because of my domain authentication) but when I try to build docker image and run it with docker run -it --rm -p 8080:80 --name console console
I'm getting this error, but I don't really understand why?
Does anyone know how I can fix this?
The connection string looks like this: Data Source=DBTest; Initial Catalog=test;Integrated Security=True
it works fine locally on my machine when I run through visual studio.
Error:
System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not acces
sible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 0 - Access is denied.) ---> System.Com
ponentModel.Win32Exception (5): Access is denied
You are (running) a docker container .. and the (running) docker container does NOT understand connection strings like
localhost
localhost\MyInstance
You need something like this:
Data Source=host.docker.internal:1433;DatabaseName=MyDatabase;
or
"server=host.docker.internal\MyInstance;database=MyDatabase;"
You may need to use sql authentication as well, to jump "from docker" to your local machine.
You have to treat the docker running images AS ANOTHER MACHINE, so if you have a localhost\MyInstance sql server, you'll have to open up remote tcp connections to it as well.
General rule of thumb.
A container running on your machine...is NOT like local code..when it
comes to hitting things like a db-server, local-sftp, etc.
If you do not use sql-authentication, you'll probably get an error like this:
Cannot authenticate using Kerberos. Ensure Kerberos has been initialized on the client with 'kinit' and a Service Principal Name has been registered for the SQL Server to allow Kerberos authentication.
ErrorCode=InternalError, Exception=Interop+NetSecurityNative+GssApiException: GSSAPI operation failed with error - Unspecified GSS failure. Minor code may provide more information (SPNEGO cannot find mechanisms to negotiate).
BONUS:
Below is a bookmarked article I have for allowing remote connections to your LOCAL machine.
https://knowledgebase.apexsql.com/configure-remote-access-connect-remote-sql-server-instance-apexsql-tools/
The error message already gives you a good hint. The client application that you are spawning in a container named 'console' is either not in the same network as your database instance or your MSSQL server is rejecting remote connections.
See Matt. G's comment how to configure MSSQL to accept connections from remote clients.
Because you didn't specify a network when executing docker run the container is implicitly connected to your host by a bridge network interface. You can inspect the IP address of a running container with:
docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container_name>
# more verbose:
# docker inspect <container_name>
You should also double check your connection string to actually point to the system hosting your database. In your case probably the IP address of your physical computer/docker host.
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>
I have a Winforms appplication written in C# that consumes web services from a Windows 2008 IIS Coldfusion server. All the web service calls succeed but one, which fails about 50% of the time with the following error:
System.InvalidOperationException was unhandled by user code
Message=There is an error in XML document (1254, 7).
with an inner exception of:
InnerException: System.IO.IOException
Message=Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
I checked my IIS logs and I get a 503 error (Service Unavailable) and an IIS code of 64 (The specified network is no longer available). Any suggestions would be great.
I run my web service in SOAP UI and I get the following error:
javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Connection reset
This code works fine at one company but this error pops up almost every time for this company I'm currently working with.
I'm not sure this is applicable to the OP's specific situation, but this may help others who arrive here nowadays. One potential cause for this exception involves mismatched security protocols. If the server you're calling requires TLS 1.2 and you're using an older version of ASP.net (<= Version 4.0) you will be using an older security protocol to make your calls unless you change it. You can force ASP.net to use TLS 1.2 (shown below). This can be done anywhere in the application, but I put it just before the line that calls the web service requiring TLS 1.2:
using System.Net;
...
//Enable TLS 1.2
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
// Call the Web Service that requires TLS 1.2
I recently got a similar message when consuming a WCF-Webservice. In my case it turned
out to be a configuration error on the server side. Maybe something is configured differently
on the one server where this happens to you?
My problem was that the default maximum message size was configured to be too small
on the server and this resulted in the same forced connection closing. There is a default
maximum message size to avoid DOS attacks...
If you are using a WCF client to connect to the service, enable service trace logging in your client application with the following config:
<system.diagnostics>
<trace autoflush="true" />
<sources>
<source name="System.ServiceModel"
switchValue="Error"
propagateActivity="true">
<listeners>
<add name="sdt"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "ErrorTrace.svclog"
/>
</listeners>
</source>
</sources>
</system.diagnostics>
Download the windows sdk and you have a nice trace viewer for these log files. It helps you get to the bottom of errors in WCF communication.
Using cross platform communication sometimes it happens (once happened to my code) that the exception thrown is not the real description of what is happening inside.
One cause of this exception is that your response time is a little lesser than time required by the webservice method to complete. So try to increase the timeout in your app.config.
If it doesn't work there could be two possible problems in your case.
If SSL is used then there is problem with SSL certificate validity.
There are some invalid characters used in XML for example your platform doesn't support Unicode characters and there is some un-supported character used in XML.
But I hope just increasing the timeout will fix this.
I did get similar error and cause was exception in XML serialization. Mostly if xmlserializer tries to read some property and that get method raises an exception due to some database connection already closed or any resources not available.
Have you tried to log exceptions in error event inside global.asax?
Sometimes if global.asax does not raise error event, then only way to log error through response filter. You can add custom response filter in the web.config, in which you will be able to analyze how much XML was correctly serialized and where it might be failing.
http://msdn.microsoft.com/en-us/library/aa479332.aspx
http://www.raboof.com/projects/elmah/
Intermediate "An existing connection was forcibly closed by the remote host" from only one destination sounds like a networking issue to me.
Try getting logs from the server you try to access and from the involved firewalls of both locations.
You may run Fiddler or NetMon / WireShark / Ethereal to diagnose further.
Connection close happen for any circumstance. Make sure the timeout is abundant on the server and the client, make sure there is no recursion in the data you are returning. Circular reference. Serialization is important in this case because the thing is being serialized when returned.
Do a WCF tracer and check the answer there. Any fault in the server will close the connection. If the server requires username, make sure those are correct. Take care of the SSL error. use WCF client to test the service.
This may be a shot in the dark but here is my theory:
The first error is happening on the web service side with a poor exception being thrown, maybe some invalid data is being passing into the service? This could return the error regarding the XML being malformed. I would do several test cases to see what data is being passed into the service and what causes the issue.
The second error I have seen before in a certain circumstance regarding a web service exception being thrown and a try catch wrapped around a using statement for the service. This combination of logic caused an early exit that wasnt cleaned up.
try to check the existing protocols in your last company and compare them with your current company,I mean TCP/Ip,...
Check the app pool recycling configuration in IIS. I have seen this error, for example, when the "Private Memory Limit" is set to a value (say 100mb) and then the w3wp process exceeds this limit which will cause the app pool to be recycled.
This normally isn't a problem since any existing connections are given time to complete and new connections will be processed by the newly spun-up app pool.
If all the connections are not closed within the shutdown time limit though (normally 90 seconds) then they are killed by IIS and the client may raise the "An existing connection was forcibly closed" error.
I have built a C# WinForms application which accesses a SQL Server 2008 for data manipulation.
The application works fine on the machine that was developed on. However when I copy the EXEs and move it to another computer (Windows XP), I got the following error during the login to the system (in other words, when i access the database).
Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed
Here's my connection string:
Data Source=vmsql;Integrated Security=SSPI;Initial Catalog=ChequeBookInventory
Stack trace is given in a screen shot
Any idea how to fix this issue?!
Most likely, the program is not executed with full trust. Either because the computer is configured like this or you are running it from a network share...
Some more info can be found here.
Grant the executing user rights to the database.
Well It was a combination of things that did the trick...
Setup code level access... I had allow full trust on machine level that network share URL through .NET Fx configuration (Whc i had to install seperately)
Install .NET latest version.. (I stuck to 3.5 ;-] )
Thanks for all the help guys :-)!!
If you want to connect to SQL Server remotely, and don't want use the username and password but Windows Authentication, that's just one way - "AD" ,I think AD might cause more problems (but AD is more secure), and I am really sorry about that my answer is not correct, I found some references about that issue,I think it might be help.
1.How to troubleshoot the "Cannot generate SSPI context" error message
2.“Cannot Generate SSPI Context” error message, more comments for SQL Server
3.“Cannot generate SSPI context” error message, when connect to local SQL Server outside domain
4.Service Principal Names (Windows)
5."Access Denied" error message when you try to access remote resources
that's bad answer bellow:
If you use "Integrated Security=SSPI", that means you can't connect to SQL Server remotely.
if you want to connect remotely, please use "User Id=myUsername;Password=myPassword;" instead of "Integrated Security=SSPI".
(Of course your SQL Server must accept "remote connection")connection string for connecting to data sources