IIS 7 Cannot Connect to SQLServer 2008

Sorry if this is the most famous question on the Internet, but it's my turn. I am trying to publish an asp.net mvc application in IIS 7 under MS Sql Server 2008. I am on a Windows Server 2008 virtual machine. I am getting the following classic error:

A network or specific instance error occurred while creating a connection to SQL Server. The server was not found or was unavailable. Verify that the instance name is correct and that SQL Server is configured for a remote connection. (provider: SQL network Interfaces, error: 26 - Search error Specified server / instance)

SQLServer checks for the removal of remote connections. My connection string:

Data Source =. \ MSSQLSERVER; Start Directory = mydbname; User id = sa; Password = mypassword

I also tried without username / password and "Integrated Security = true". Only one instance of SQLServer is installed. I tried to access my webpage locally and remotely. There is no active firewall in the virtual machine.

+3
source share
6 answers

Thanks guys for trying. I found a solution, and this is related to the information that I forgot to give. Hope this helps someone new, like me, on these things.

NHibernate, nhibernate.cfg.xml. web.config (/). , NH. :

string connectionString = ConfigurationManager.
ConnectionStrings["myConnectString"].ConnectionString;

NH :

Configuration cfg = new Configuration();
cfg.Configure(cfgFile);
cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionString, connectionString);

:

"mydb" . . NT AUTHORITY\NETWORK SERVICE '.

, .

PS: "." . \MSSQLSERVER " ". Ian Jared .

+3

, TCP/IP SQL Server.

+3

, -?

, , , a; , , windows .

localhost . sql, ?

+1

, :

ConnectionString="Data Source=(LOCAL)\MSSQLSERVER;Initial Catalog=mydbname;User ID=sa;Password=mypassword"

, - case sensit, , "Id" "ID".

: , \MSSQLSERVER?

+1

, SQL?

=; = mydbname; = sa; = mypassword

UPDATE:

from

:

  • , , , DNS , ping- ( ).
  • , SQL Browser.
  • , sqlbrowser.exe / UDP- 1434 .
+1

, ( 8 ) , , , : (

web.config , :

Integrated Security = False instead of True ... and now it works fine

0
source

Source: https://habr.com/ru/post/1703186/


All Articles