I really hope someone can help out. We are in the process of migrating all of our web applications to a new hosting environment.
Most of the applications are .NET 4 / 4.5. However we have a few running .NET and one running classic ASP.
On all the sites running .NET 2.0 we are getting:
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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
The connection string points to the DB server by IP address - not name.
I'm also getting a 500 error on the classic ASP - but I am still working on the specific error. My suspicion is they are the same - mainly because it takes 30 seconds for both apps (classic ASP / .NET 2.0) to render the error page.
The new environment is Server 2012. They are coming from a server 2008 environment.
Is there something about IIS 8.5 that needs to be set-up to all the db access on older framework apps?
Related
I always get the above error when trying to connect to a SQL server 2000 database hosted on a "server" with Windows XP pro. The client pc (my working environment) is Windows 7.
Up to now I have developed my application using Visual Studio 2010 and Net framework 4.0.
All was working correctly. Then I have installed Visual Studio Express 2012 for Web and ASP.NET 4.5.
Now, when i try to connect via SqlConnection conConnection .Open() i get the Exception:
A connection was successfully established with the server,
but then an error occurred during the pre-login handshake.
(provider: TCP Provider, error: 0 -
An existing connection was forcibly closed by the remote host.)
Please note the second message, because I have found very little info on that: An existing connection was forcibly closed by the remote host.
I have yet unsuccessfully tried a myriad solutions, including:
Various connection strings (Encrypt=false; )
netsh WinSock Show Catalog > winsocks.txt (don't seem to spot any strange application here)
netsh Winsock reset on both client and server
Rebuilding the app from Visual Studio targeting Net 4.0 / Net 4.5
Use Visual Studio Development Server or Local IIS Web Server
IIS reset, restarting Client and Server pc variuos times
Checked the SQL Server 2000 properties, connections, logs, profiler...
What other could I try next without disinstalling Net 4.5 (and Visual Studio 2012)?
Important additional info
This same application is deployed in a production server (Windows 7, IIS 7.5, Net framework 4.0).
The application actually in production was compiled with Visual Studio 2010, net 4.0, and is connecting correctly with no errors (thankfully)!
So, the problem has arisen on my client machine after I have installed VS Express 2012 and Asp.net 4.5. (I have also tried to open and recompile the solution with VS2010, but I get the same exception).
EDIT
For testing purpose, I have deployed my application, compiled with VS 2012 / Net 4.0, to the "production" server (on which I have never installed Net 4.5 of course).
For this I have created a new Web Site, with Application pool set to Integrated pipeline and targeting Net Framework v4.0.30319.
Now, this test web site connect successfully to my test SQL Server database (SQL 2000) and also to my production server database (SQL7).
Clue:
the problem resides only on my client pc, and the culprit is Net 4.5?
EDIT 2
Connecting via Visual Studio 2010 or 2012 Server Explorer, Data Source: Microsoft SQL Server (SqlClient) gives the same Exception (only difference is that now is pre-login handshake timeout).
Instead Connecting from Microsoft SQL Server Management Studio 2008 works fine! (Server type: Database engine; Server name: myserver\SQL2000; Authentication: SQL Server Auth; Login: Password)
How can be that the connection from SQL Server Management Studio works fine?
Did you uninstall VS 2012 to "fix" this issue? Why can't you install .NET 4.5 on the server or copy the DLLs to the server per Marc Gravell's post at http://marcgravell.blogspot.co.nz/2012/09/iterator-blocks-missing-methods-and-net.html?
I am essentially having the same problem. ASP.NET Project that runs successfully on a Win 7 computer in visual studio 2010 but moved to a Windows 8 box running Visual Studio 2012. Project is converted by VS when running it throws the SQL server error message described above. SQL server is remote but both clients (Win 7 and Win 8) are local on the same network. One works and the other doesn't.
Comparing setup on both machines in IIS I found that there is a difference between the configuration of the Application Pool in use by the web application. The Identity property defaults to "ApplicationPoolIdentity" but if you change it to "NetworkService" then the problem is resolved. Hopefully this will help someone else as I have done an extensive search and found nothing that pointed to this.
I have a strange problem.
I have web application that use both Oracle and sql server 2008.
I want to use the Oracle Data Provider for .NET 64bit version.
in order to that i am setting the application pool to enable 32 bit = false, otherwise the ODT.NET 64bit is not working.
So also i had to compile the assemblies to be 64bit.
but when i do so i'm getting the following error from sql server:
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.
when i compile back to any cpu it's working fine, but again only if i set the application pool to enable 32bit=true.
what make things even more strange is that in my test and pre prod servers it's working fine with 64bit setup both for sql server and oracle.
but in my prod server i keep getting this error from sql.
so maybe it's IIS problem in my prod machine?
what i did so far is to compare all the settings in the iis to be the same in all machines, but it didn't solve the problem.
what could it be?
The problem solved!
it turned out that in that specific machine i need to call the sql server in the connection string by name and not by ip.
I wrote a Web service in ASP.NET using Microsoft Sync Framework 2.1 and SQL CE 3.5 SP2.
On development system (Win7) everything works fine.
After publishing on a server with Win2k8 R2 Web synchronization throws an error : System.UnauthorizedAccessException because it can't
access :
"HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server Compact Edition\v3.5"
Stacktrace:
Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str)
Microsoft.Win32.RegistryKey.CreateSubKey(String subkey, RegistryKeyPermissionCheck permissionCheck, RegistrySecurity registrySecurity)
Microsoft.Synchronization.Data.SqlServerCe.SqlCeSyncUtil.CreateMachineID()
Microsoft.Synchronization.Data.SqlServerCe.SqlCeClientSyncProvider.CreateSyncSubscription(Guid serverId)
Microsoft.Synchronization.Data.SqlServerCe.SqlCeClientSyncProvider.get_ClientId()
Microsoft.Synchronization.SyncAgent.GetClientInfo()
Microsoft.Synchronization.SyncAgent.DataSynchronize()
How can I fix that problem without running into security issues?
Thx
set the ClientId property on the client provider (SqlCeClientSyncProvider) in your client application.
I'm deploying a small ASP.NET (framework 3.5) application in a Windows Server Web 2008 32 bits, IIS 7. The applications needs connection to an Oracle DB in another Server, using the tradicional DataAdapter, Oracle Connection, etc.
I´ve installed correctly the Oracle Client in the server (the server is another server´s client) and I´ve checked that this server has access to the server where the database is.
Even though my app isn´t able to connect to DataBase. The message says that Oracle components haven´t been found. It doesn´t find the OleDB Provider for Oracle or some dll.
¿Something I shluod know about permissions of the ASP.NEt users or something like this?
Some idea??
Thanks in advance.
Gus.
Check the path. It could be that the Oracle client directory is not on the path of the account that runs your ASPNET app.
Actually there are other steps you can go through, to verify the Oracle client install.
This article is old but may be helpful.
We have an ASP.NET application written in Visual Studio 2003 (c#) using SQL Server 2000 as database. It’s an old web application that our clients have been using for 4+ years.
Now, we needed to upgrade the application to work on Windows Server 2008 using SQL Server 2008, both 64bit, both on the same machine. So we ported the application to Visual Studio 2008, made some needed modifications and successfully installed the application on Windows Server 2008 with database still being the old SQL Server 2000. Everything worked fine. But as soon as I modified the connection string to work with the new SQL Server 2008 64bit, it stopped working. Basically the web browser just shows – The webpage cannot be displayed; no error messages whatsoever.
I monitored the processess and event log - basically it seems that asp.net worker process is generating errors until it stops working. And I can’t figure out why. All should be fine on SQL Server 2008 side, all protocols enabled, even disabled firewall; i can connect to the instance using Management studio from the same server (64bit) and from other development machines (64bit/32bit).
Then i tried using the web application from my development machine (still Vistual Studio 2003 one, i.e. 32 bit with ASP.NET 1.1) and connect to the new SQL Server 2008 and i got „Server application unavailable“ error. Same thing happens, worker process is generating errors until it stops working.
I used IIS Diagnostic Tool to debug the moment the error occurs – all i got was basically unlimited numbers of „First chance“ exceptions (problems with msvcr80.dll, mscorwks.dll). If I limited the number of those, I also managed to get „Kernel32!TerminateProcess“ exception, which after analysis stated that it didn’t detect any problems with that; only one time i got the warning, describing that 1 client connection was executing for more than 90 seconds.
I dont think the problem is on the 64bit Windows server 2008 or SQL server 2008 side, since when, just for checking, we used Sharepoint application with the new SQL Server 2008 as database, it connected just fine.
So what am I missing with our ASP.NET application configuration/development that it cannot connect to 64 bit Sql server 2008?
Thanks and regards,
Martin.
This sounds like a configuration problem, probably a permissions problem. Your Sql Server is on a different box than the your web server? If so I would look at what user your web site is running under. Make sure that user has access to the Sql Server.
If your user does have access make sure it has access to travel the wire to your SQL Server. Try to connect to the SQL Server via Sql Management Studio with the user's credentials.