fuel9 / DisplayMonkey

Display Monkey digital signage solution
Other
126 stars 50 forks source link

[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. #145

Closed ghost closed 4 years ago

ghost commented 4 years ago

Hi,

I've read through a few of the posts here but still cant fix an issue I have with connecting to the SQL instance.

Im using a w10 machine with SQL 2014 Express on. Ive tried a few different combinations for the web.config but I just cant get it working.

could someone have a look for me please?

Example of config. (test server)

Local PC is ASM-D053 SQL is installed locally ASM-D053/SQLEXPRESS DB is called DisplayMonkey Local login account is DS Password is ds.1234

so would the below be correct?

I've tried localhost, asm-d053, local, and those combo's with SQLEXPRESS on the end but all have failed.

Event viewer is saying: Exception message: 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

the SQL server does accept remote connections.

Would anyone be able to help please?

michaelmalmgren commented 4 years ago

Hi Dave,

Try opening your server instance using SQL Mangement Studio, from there you can verify the name of the instance, that the database is created and that the user DS is an owner of the database.

Your web.config connection string should look something like this if your server instance is named ASM-D053:

connectionString="metadata=res:///Models.DMModel.csdl|res:///Models.DMModel.ssdl|res://*/Models.DMModel.msl;provider=System.Data.SqlClient;provider connection string="data source=ASM-D053;initial catalog=DisplayMonkey;persist security info=True;user id=DS;password=ds.1234;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />

Cheers, /M

ghost commented 4 years ago

Thanks Michael, ive got it sorted now with your help. I also noticed that I only had windows authentication enabled on the SQL server so had to change that for the local user account to work.

thanks for your help