Azure website sometimes can't connect to SQL Azure database - asp.net

I've been testing a website in Azure for about a month (Free trial), and now I've subscribed to pay-as-you-go. When I was on the free trial, I had absolutely no connectivity issues. Now I've deployed again to a fresh website created on the pay-as-you-go subscription with the same settings (scaling mode etc.) as the previous one. However, now when I navigate to my site, it sometimes fails to connect to my database:
Server Error in '/' Application.
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
Description: An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error and where
it originated in the code.
Exception Details: System.ComponentModel.Win32Exception: 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
Source Error:
An unhandled exception was generated during the execution of the current web request.
Information regarding the origin and location of the exception can be identified using
the exception stack trace below.
Stack Trace:
[Win32Exception (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]
[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
accessible. Verify that the instance name is correct and that SQL Server is configured
to allow remote connections. (provider: TCP Provider, error: 0 - 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.)
I try to refresh the page and it connects. After a few minutes, when I try again, I sometimes get the same error again, but sometimes not. I never had a single connectivity issue in the free trial mode. Why does it happend and how can I prevent this problem?

Transient errors are expected in a cloud environment. Let's say that a database call fails, if you retry a few milliseconds later, that same call would now work. To shield you from these errors, you need to implement a retry logic. If you use Entity Framework 6, you're in luck since it's baked in: http://msdn.microsoft.com/en-US/data/dn456835
Here's a quick video on how to implement this: http://www.azurerocks.com/0_oaw-merMw
You can also use the Enterprise Library Transient Fault Handling Application Block: http://msdn.microsoft.com/en-us/library/hh680934(v=pandp.50).aspx

Related

Facing connection issues with ASP.NET SignalR

My SignalR server (ASP.NET) and client (ASP.NET) both are working fine as excepted but multiple times on a daily basis, I'm getting the following two errors at the end of the SignalR client (ASP.NET):
System.Net.Sockets.SocketException (0x80004005): An existing connection was forcibly closed by the remote host
System.Net.WebException: The request was aborted: The connection was closed unexpectedly.
I've looked in the following ways but still unable to find out the root cause
Check High CPU usage when the error occurred.
Tried to send lots of data to the Server but received all the data received successfully at the Client through the Server.
Checked server is not creating unnecessary connections. Only max three connections are there.

ORA-12570: Network Session: Unexpected packet read error when connecting to an oracle database from asp.net application

I am getting ORA-12570: Network Session: Unexpected packet read error when connecting to an oracle database from asp.net application.
Error Frequency: Not consistent and works fine one time and throws error next time
Environment Detail
Oracle Managed Data Access v12.2.1100
Visual Studio 2015
Oracle Database 12c Enterprise Edition
Error Stack Trace
Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-12570: Network Session: Unexpected packet read error ---> OracleInternal.Network.NetworkException (0x80004005): ORA-12570: Network Session: Unexpected packet read error ---> 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
I would appreciate any solution to this issue as it is difficult to figure out myself and tried changing code but no help.

Details: java.sql.SQLRecoverableException: IO Error: Connection reset

I am trying to deploy the configuration and runtime using IBM Mobilfirst Server Configuration Tool for the server configuration, and I end up with a connection reset error. The error from the logfiles is
Cannot access database: ServiceName.
Details: java.sql.SQLRecoverableException: IO Error: Connection reset.
Kindly help in resolving this issue.
Which part is throwing the error? Is it DB side? Network Connectivity?
The ServerConfig Tool (SCT) creates the URL first by considering that the database name as SID. If the connection fails, it then connects using the database name as a service name.
I see that you are seeing the error - 'Cannot access database: ServiceName. Details: java.sql.SQLRecoverableException: IO Error'.
When SCT notices an unknown error while connecting it stops the connection process with the above error.
I would recommend you to run the ANT tasks for configuring MFP to get detailed logs on why configuration is failing.

After upload my ASP.NET site cannot login to the admin panel

i have developed an asp.net web site for university. in visual studio i gave the server hosted sql server database connection string. not the local one. then when i run it on the local host with server hosted sql server database it allows me to log in to the admin panel.
but after i upload the same set of files which use the same server hosted database connection string, when i try to loging using asp.net template login from to my admin panel, it shows follow error. but in the local host the same hosted sql server worked properly.
i used here asp.net configuration to create the admin and only allowed administrator to access administration folder which has all the side administration pages.
please help me to fix this... thank you!!
Error message
Server Error in '/' Application.
A network-related or instance-specific error occurred while
establishing a connection to SQL Server. The server was not found or
was not accessible. Verify that the instance name is correct and that
SQL Server is configured to allow remote connections. (provider: SQL
Network Interfaces, error: 26 - Error Locating Server/Instance
Specified)
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: A
network-related or instance-specific error occurred while establishing
a connection to SQL Server. The server was not found or was not
accessible. Verify that the instance name is correct and that SQL
Server is configured to allow remote connections. (provider: SQL
Network Interfaces, error: 26 - Error Locating Server/Instance
Specified)
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Are you using an IP address for your connection? If the database is on the same server as your application you will need to use the home address "127.0.0.1" plus any port configuration you might have. Otherwise it wont find itself.
Same goes if your using a URL connection, you might need to add the URL to the server host file so it redirects back home.
The fact that you can connect from your local dosnt mean anything. Its clearly telling you the problem, your "SERVER" cant connect. Do you have Remote Desktop access? If you can, remote into the server and try connecting to your DB from there.

How can I connect a godaddy site on shared hosting to use a mongodb db on amazon ec2?

I have an ASP.NET MVC4 site on godaddy shared hosting and it uses mongodb for its storage for our reporting system and I have implemented a MongoDB Membership provider for authentication. I have set up the mongodb instance with an elastic IP. The instance is on Win 2k12 for the moment, with MongoDB running as a windows service. Locally, I can see it, ping it, use it while debugging my app, connect MongoVUE to it and even remote desktop into it.
However, when I deployed our site to godaddy and try to register a user, which has the MongoDB Membership provider trying to save it into the database, I basically get a connection timeout error. I've pasted the error at the bottom.
Things I've tried:
1. looking up the godaddy site's ip and opening all tcp ports in the amazon security group for traffic coming from that ip
2. opening up all tcp ports for all traffic from all addresses
3. turning off the windows firewall on the mongodb server
4. 2 and 3 together
I'm wondering if maybe the mvc site can't get out of the godaddy network in order to get to the amazon ec2 instance. So maybe its more of an issue of godaddy blocking it than amazon?
Any help would be greatly appreciated. Thanks!!
Error message:
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 (my ip):27017
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: 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 (my ip):27017
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SocketException (0x274c): 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 (my ip):27017]
System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +208
System.Net.Sockets.Socket.Connect(EndPoint remoteEP) +120
System.Net.Sockets.TcpClient.Connect(IPEndPoint remoteEP) +70
MongoDB.Driver.Internal.MongoConnection.Open() +158
MongoDB.Driver.Internal.MongoConnection.SendMessage(BsonBuffer buffer, Int32 requestId) +196
MongoDB.Driver.Internal.MongoConnection.SendMessage(MongoRequestMessage message) +125
MongoDB.Driver.Operations.CommandOperation`1.Execute(MongoConnection connection) +193
MongoDB.Driver.MongoServerInstance.RunCommandAs(MongoConnection connection, String databaseName, IMongoCommand command) +189
MongoDB.Driver.MongoServerInstance.Ping(MongoConnection connection) +331
MongoDB.Driver.MongoServerInstance.Connect() +371
MongoDB.Driver.Internal.DirectMongoServerProxy.Connect(TimeSpan timeout, ReadPreference readPreference) +222
I just heard back from GoDaddy that they intentionally block access to external resources/ip's for their shared hosting accounts. What crap! They're intentionally making their product less useful to their customer to try and force them to pay for a more expensive tier of hosting. If anyone knows of a good shared hosting provider for Windows/.NET that doesn't do stuff like this, I'm all ears! Thanks!

Resources