"Maximum number of connections already opened" Error Message - asp.net

I developed a web site using Sybase PowerBuilder V12.0 Classic and the output is deployed and converted to ASP.Net (ASPX) web pages.
The Database connection is configured and used properly as the data is displayed in the web application using DataWindow Objects and is a direct connection with sybase Database Server using Dsedit Tool and No ODBC is used.
I edited The Sybase Databse configurations related to remote servers and connections to be more than the default value which was 25 although the real number of users will not exceed that in the same time.
Recently I received an error message when some users connected to the web site and after making valid logins:-
The Error Message is:-
Maximum number of connections already opened
ct_connect(): user api layer: external
error: The maximum number of
connections have already been opened.
I am confused about the causes of that error as I think I had made all configurations needed and I checked evey option and setting related to the Number of Connections in The Sybase Database server, The Application Deployment Settings in Sybase PowerBuilder V12.0 Classic, and The IIS Settings.
I use Windows Server 2003 and the IIS version is 6.0 in the Web Server.
I appreciate any suggestion or hint to solve that problem and Thanks in Advance :)

The error message says it all really. There are too many concurrent connections to your database.
Perhaps your application doesn't close all of them. If you do not close database connections, connections can remain opened for some time.
Now, I never developed for Sybase, but that is what is usually the case with MSSQL server when this error occurs.

Related

ASP.net can't connect to SQL Server after being deployed to hosting site

I'm developing an ASP.net web application.
My default page is a simple login screen.
I am using Visual Studio to develop the application.
It will run using Visual Studio and when the data is entered to the text boxes and the button is clicked, it sends the request to my own server running Windows Server 2012 with SQL Server 2014 installed.
I will also mention that the ASP application is being created as a secondary application for an Android application. The Android application is using the same database over Internet connection so I know that the server and SQL server both can accept read and write calls.
I have tested the ASP application using WebClient calls to php files which connect to the database (this works on Android) and also OracleClient and SQLClient calls all of which work from Visual Studio on my workstation to the server machine. These all work fine to send and receive data from the database.
The problem is once I deploy the application to my hosting site the calls no longer seem to work. The default login page opens but after attempting to login I receive errors as follows:
Exception Details: System.ComponentModel.Win32Exception: No connection could be made because the target machine actively refused it
[Win32Exception (0x80004005): No connection could be made because the target machine actively refused it]
[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.
Can anyone help me with this?
It sounds like your database is accepting connections from some clients, but not your hosting server. I would try testing a SQL connection straight from the hosting Server and see if a test connection can be successful. If you can get that to work it should work from the web server.
This article Quick ways to test OLE DB Connection String on creating a empty TestConnection.udl file will be helpful. It is easier to try different connection string settings through the Data Link Properties UI. When you save the file, you can see the connection string if you open it in a text editor (assuming it is successful).
If it's not a problem with he connection string, check that you do not have a firewall blocking connections between the Windows 2012 and SQL servers. It could be the widows firewall on either machine, or another firewall at the network level.

classic asp IIS 7.5 sql server performance

We have been using this external program thats using classic asp, and sql server express 2008R2 on windows server 2008R2 running IIS 7.5
It has been running fine until the last month when almost each page is taking atleast 2 minutes to load. If i reboot the web server, everything works fine for the first few mins until it goes back to same old issues.
It appears that the app is resetting some setting after 2 minutes and then its able to respond. I am not sure what setting that would be.
I tried to set up failed trace request, and found that it never finished or rather the log file never capture the error. (even after increasing the log file size. I tried this multiple times)
The program is using SQL server native client 10 to talk to sql server. I have played around with connection pooling, changing the app pool from classic to integrated and vice versa. It does not seem to be a db issue, as the activity monitor does not show too much consumption and sql server wait stat that i see is ASYNC_NETWORK_IO and PREEMPTIVE_OS_WAITFORSINGLEOBJECT which relates to the fact on how the client is processing the results sent from the db server.
I am looking for suggestions on how to debug this issue. My guess has to be the way the connection from asp to sql server.
Thanks in advance.

OLE DB Provider for SQL Server works, but not SQL Native Client

I'm running out of ideas so checking if anybody can shed some light.
2 tier Client-server application
SQL Server 2005
Workstation: Windows XP
Client-Server Application 1 uses SQL OLE DB Provider. (Provider=SQLOLEDB.1)
Client-Server Application 2 uses SQL Native Client. (System.Data.SqlClient.SqlConnection)
Somehow, application 1 works well but application 2 needs to have Timeout in connection setting to be 30 seconds to make it work.
Using a tip I learned from JohnnyCoder's Database Connectivity Test with UDL File, I tracked down the problem is somewhere around driver. When I try Microsoft OLE DB Provider for SQL Server, it connects immediately. When I try SQL Native Client, it doesn't take long. It fails even it I set connection timeout to be 60.
Both of the applications work well on other installations but not on one specific site. So it has to be related to some environmental settings such as security, firewall, etc.
I tried installing new SQL Server 2005 Native Client on workstation. No luck.
So my question is:
Why does Application 2 ever make it work when the client actually cannot connect? Is there internal logic to use OLE DB when SQL Native Client timeout happens?
What else would you take a look?
Answer: their network firewall blocked TCP/IP packets.
As a result, SQL Native Client timed out with TCP/IP after 20 seconds and then tried Named Pipe which made it work.

Error 40 in SQL Server

I have a website in Asp.net that I have installed on my server, and my website's database in SQL Server 2008 R2. My website has pages that contain ActiveX components. When I run my website on the server the ActiveX components are working correctly, but there is a problem when I run website from client.
The pages that do not contain ActiveX components work correctly and I can get and insert data from database. In the pages that contain ActiveX components it gives me SQL Server error number 40, that it could not open the connection.
Can anyone help me resolve this?
As Steve B implies in his comment the problem lies in the ActiveX component making a call to the database directly. The connection string in your app specifies a connection made from the Web server to the Database server. These connections work because your firewall settings allow for inbound connections to the Database server from that Web server. When the connection is set in the ActiveX control to connect directly to the Database, you are getting connection failures because the firewall is blocking the inbound connections from the clients running the ActiveX component. The fix is to redesign your application so the ActiveX component that lives on the client machine no longer makes calls directly against the database; make use of web services or something of that nature. If the clients are all internal to the domain (aka this is a private app and will never be public facing), chances are the Firewall isn't properly configured to allow internal connections to the database server.

Connection to SQL server 2000 on a windows server 2003 domain controller

I am trying to connect an ASP.NET 2.0 application hosted on a client machine to an SQL server 2000 instance which is installed on a domain controller running windows server 2003 (I appreciate this is not best practise, but it is something I cannot change). I am using SQL server authentication, not Windows authentication.
During debugging, the following error is displayed at the point the 'connection' is attempted within the web application (not on running any object within Sql Server):
"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"
I have done some research, and have checked a variety of things:
1) I am certain the conection string is correct - in fact I built a little Windows app that uses the same connection information and connection succeeds...
2) This is limited to the web application - a windows application running on the remote client machine connects just fine using the same connection string (see 1).
3) The firewall settings on both computers do not prevent the connection (see 1).
4) I can ping the windows 2003 server (see 1)
5) The SQL Server credentials definitely have the rights to the objects needed
6) If I (temporarily) put the web application on the windows server 2003 and run it, it loads and runs fine (using a browser on a separate machine, or on the client machine I am trying to connect) - suggesting this is only an issue with a remote connection, and confirming the connectivity between the machines again, and also confirming the necessary security right of the SQL Server user.
7) I can start query analyser on the client machine and using the same SQL server credentials, can run the same queries on the target database just fine.
Stumped. Please help!
You need to go into the SQL Server Configuration Manager and make sure the Named Pipes option is turned on. It is not turned on by default when you install SQL Server.
Because of the research I did in the original question covering the ability of a windows app to connect but not the ASP.NET app to connect from the same machine, and the confirmation the web app was working on the server itself, I was convinced SQL server was set up correctly, that connectivity and firewalls were not a problem - it must have been a difference in the security credentials of the windows app versus the web app.
The windows app runs in the security credentials of the logged on windows user and authenticates using that, whereas the webapp runs in a restricted account and does not pass these credentials over when connecting to SQL server by default. I simply added to web.config, which impersonates the user account within which the web app runs, and it all worked!
Problem solved.

Resources