Recently I have upgraded my SQL Server from 2012 to SQL Server 2014.
Now all my applications connected to this server can't instantiate the connection.
I debug the code and I get the following exception :
'Connection.ServerVersion' threw an exception of type System.InvalidOperationException
My connection string like this :
<add name="sql_r"
connectionString="Data Source=172.XX.XX.X;Initial Catalog=Attendance;User ID=ll_web;password=XXXXXXXXXXX;"
providerName="System.Data.SqlClient"/>
Apart from the code, there are a couple of possible things which could make your SQL Server Connection
failed from the setup itself. I will try to list 3 which I think might be common:
"service.msc"
from your Run
windows. Check for service name SQL Server (YourInstanceName)
(the default for YourInstanceName
is MSSQLSERVER
). Check if it is running. You may also want to check if SQL Server Browser
is running. Run them.paths
are among the allowed paths
. You could get the paths
by [right-clicking - properties -> path to executable]
on the service names of your SQL Server
in point 1. Include them in your Firewall
allowed paths.SQL Server 2014 Configuration Manager
, in the SQL Server Network Connection -> Protocols for [YourInstanceName] -> TCP/IP
. Do right-click -> properties -> IP Addresses Tab
, check the TCP Port
for you IP Addresses
. Typically all is set to 1433
, including the IPAll
. If this is not the case, set them.