views:

173

answers:

1

I am playing with MVC and I made a simple site. I have an seperate machine running SQL Server Express and on it I have a simple table called "Log". The table has ID, Timestamp, and Message fields. I added the database to my "Data Connections" on my "Server Explorer" section.

In my MVC website I created a new LINQ to SQL class and dragged the Log table to the design surface which created the datacontext.

So I do the rest, get the data using LINQ, pass it to the view, and loop through it. This works fine when I run it locally. However, when I publish it to our IIS server it gives me the following error.

Server Error in '/' Application.
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)

So it seems that it can't find the server. How do I fix this?

+1  A: 

Does your IIS server has access to your Sql Server Express?

Gregoire
I'm an idiot. The IIS server is on one subnet and the SQL Server is on another. Opening the SQL server ports to the other subnet made it work. Doh!
Clint Davis