Authentication error when connecting to redis cluster - c#

I have installed the redis cluster version 6.2.3-alpine on a kubernetes cluster and enabled authentication by setting the following parameters in the config map:
masterauth a-very-complex-password-here
requirepass a-very-complex-password-here
When I try to connect using an AspNet Core application, on the first attempt the following error occurs:
(error) NOAUTH Authentication required
On the next attempt to connect, this error no longer occurs.
After the application successfully connects to redis, it runs for about 2 or 3 minutes and then stops communicating, with no apparent error
This behavior happens intermittently and I cannot find a cause for it.
Can anyone help me with this problem?

Related

Fatal NServiceBus exception when starting endpoint, cannot open database

We just made some changes to our project and deployed it. We have 7 endpoint databases in our SQL Server database for NServiceBus. We recently added 2 more. One of the two services using one of the two new endpoints fails to start. When looking at our log file we see the following error:
FATAL NServiceBus.GenericHost [(null)] - Exception when starting endpoint.
System.Data.SqlClient.SqlException (0x80131904): Cannot open database "A_NSBEP_WebEventProcessor" requested by the login. The login failed. Login failed for user 'xxxx'
The connection string is
'connection.connection_string'='Data Source=localhost\DevSQLServer;Initial Catalog=A_NSBEP_WebEventProcessor;Integrated Security=true;Enlist=true'
All of the connection strings are configured in OctopusDeploy. They are all identical except obviously for the database name. All of the other services start and login to their respective endpoint with no problem. I even went through the process of creating a .udl file, connecting to the database and using that slightly different connection string. Still without success.
Any thoughts?

Random unable to connect from Azure to On-Premise MySql

We are using different services in the Azure Cloud (App services / function apps) to connect to a On-Premise MySql database on Ubuntu. This works the most time very well, but sometimes and totally random we received the following error.
Detail:
The connection works most time great and everything seems correct configured. Only sometimes e.g. every 27th request runs into an error. I assume the received error message is maybe wrong.
Example extract from our log:
2018-02-21 15:53:55.647 +00:00 [Error] Microsoft.EntityFrameworkCore.Database.Connection: An error occurred using the connection to database 'XXXXXXX' on server 'XXX.XXX.XXX.XXX'.
MySql.Data.MySqlClient.MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.
at MySqlConnector.Core.ServerSession.<ConnectAsync>d__56.MoveNext() in C:\projects\mysqlconnector\src\MySqlConnector\Core\ServerSession.cs:line 212
We are connecting to this database from different sites, but this error only appears from the Azure Cloud.
We double-checked the connection string, firewall settings and outgoing IPs several times.
Connection String:
Persist Security Info=True;server=xxx.xxx.xxx.xxx;database=xxxxxx;uid=xxxxx;password=xxxxx;port=3306;
On some days we doesn’t received this error, but on the other day many times per day and totally random. It would be great to get help from you to identify the problem and solve it soon. Thanks a lot!
It is hard to help without a code example.
You can only check the common things:
- connection string correct order
"Server=TheServerAddress; Port=YourPortNumber; Database=YourDatabase; Uid=YourUsername; Pwd=YourPassword;"
- add default port. Ex.: 3306 to connection string
- check the query code async or not and if its the same in other application
Also you can try a retry:
https://blogs.msdn.microsoft.com/bartr/2010/06/20/sql-azure-connection-retry-update/
http://peterkellner.net/2011/01/21/sqlazure-connection-retry-problem-using-best-practices/

Azure MobileApp Client SDK crashes on Xamarin.Forms (Android)

The reproduce the error, I've created a blank mobile app and a new sql database.
Afterwards I've followed the quickstart guide and downloaded the backend and the Xamarin.Forms project.
I've deployed the Web-App to azure and started the Android app using the 5'' KitKat (4.4) XXHDPI Phone (Android 4.4 - API 19) emulator.
As soon as I add an item to the TodoItem - List (you see, it's the default sample app of xamarin mobile apps), the todoTable.InsertAsync call fails.
Unfortunately, there is no detailed error.
It's just a error message telling "An unhandled exception occured".
In the output window, I can see the following error:
03-01 19:48:33.781 I/MonoDroid( 1512): UNHANDLED EXCEPTION:
03-01 19:48:33.793 I/MonoDroid( 1512): Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException: The request could not be completed. (Internal Server Error)
03-01 19:48:33.793 I/MonoDroid( 1512): at Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient+<ThrowInvalidResponse>d__24.MoveNext () [0x001ec] in <42e24ce875d34485ad11c4f8aebb904a>:0
So I've had a look at the azure mobile app in the azure portal.
Before I've ran the tests, I've enabled almost all the logs.
I can see FREB-Protocols I can see a post request to /tables/TodoItem which failed with http 500. Unfortunately it does not tell my anything about the error itself. Authentification is disabled, so the authentification should not cause any problems.
I've included the whole log here:
https://1drv.ms/b/s!AqCo2Ottp6L6wC7-nOFkDN7cERE6
Does anyone got any idea what could be wrong? Sitting here since far to many hours, guessing what could be wrong.
The Internal Server Error means your service is crashing - that's why it is not producing any logs. You've not shared anything about your backend, but that is where your problem is.
Run the service locally and attach a debugger and step through the backend code. You can find details of running the service locally (attached to a local SQL instance) in the HOWTO documents on learn.microsoft.com.

: MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server

So, I am using MongoDB on a Azure VM and I have a web site hosted on Azure web Sites as a service.
My problem is: Sometimes I get an error like this:
"Exception: MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the 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"
After I got this error, just I access the endpoint again and I have success immediately.
Details:
ConnectionString: mongodb://xxx.aaa.net:1000, xxx.aaa.net:1001, xxx.aaa.net:1002/?readPreference=nearest
Before open the conection with Mongo I set the MaxConnectioIdleTimeout property like this "MongoDefaults.MaxConnectionIdleTime = TimeSpan.FromSeconds(30);" , To keep alive connection, because the idle timeout for azure LoadBalancer become inactivy after 4 minutes by default.
So, I don't know what's going on.
Can anybody help me?
Yes, 4 minutes. Azure closes a connection session if it keeping on idling up to 4 minutes.But the mongodb driver don't know it,it will still get this connection form connection pool.
You can either set the MaxConnectionIdleTime(in mongodb driver settings) less than 4 minutes, or set the max session idle time of azure VM more larger by powershell (30 minutes max).
BTW, if your web site which also hosted on azure access the mongodb server with the private IP(PIP), there won't be this problem.
As I asked #apodemakels for some official documentation, I have found MongoDB Production Notes where it states:
The TCP idle timeout on the Azure load balancer is 240 seconds by default, which can cause it to silently drop connections if the TCP keepalive on your Azure systems is greater than this value. You should set tcp_keepalive_time to 120 to ameliorate this problem.
In addition, there's a ticket on MongoDB Jira with regard to this issue.
I hope both these documents may help with this or in case someone faces a similar situation.

Cannot access wcf service hosted on iis from php with soapclient

This has been really painful for the last few hours and I just have no more ideas what to do.
Tried many solutions that I found on here without any luck...
I have an iis server that is hosting a wcf web service. Simple stuff.
I can connect to this (example: http://mydomain.com/Service.svc?wsdl) from the iis server and all other computers without any problems.
So I went on to make a php client on my computer - (using xampp via localhost) - (not on the iis server)
$wcfClient = new SoapClient('http://mydomain.com/Service.svc?wsdl');
$args = //input data
$response = $wcfClient->GetData($args);
print_r($response->GetDataResult->Post);
This works perfect. No problems at all. It returns all the data... Then I went on to upload this to my hosting account. This is the error I keep getting.
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from ....
I have no more ideas. Disabled firewall, changed web.config a million times and still no luck. I tried the file_get_contents method to see what's up. I keep getting:
failed to open stream: Connection refused
I just fixed this by changing the port to 80 on the iis server...

Categories