views:

83

answers:

2

Hello, I've been running an ASP.NET MVC application on my IIS 7.5 localhost (on my Win7 Pro box) server with SQL Server 2005 Developer Edition.

I went to put the application on my production server (IIS 7, SQL Server 2008) and am getting SQL Server connection errors. Here is the error I get when I try to browse site root:

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)

I have triple checked my connection string. My host's connection string was in the format XXX.XX.XX.XX,XXXX. Is it normal to have a comma following the IP Address?

Does anyone have any suggestions for something I may be missing?

Thanks.

+1  A: 

Take a look at this resource:

http://www.connectionstrings.com/sql-server-2008

A comma after the IP address indicates the port. It should be 1433 unless you have multiple instances.

Nissan Fan
Thanks for the answer. I'm getting closer. The connection strings that are read from the Web.Config are working now (my host had a bad connection string).However, in my DAL, I have an App.Settings file that contains a connection string used by certain portions of my application. Does that get compiled into my DAL assembly? Only pages that use that connection string aren't working...Thanks!Jack
jchapa
Oops, typo. I meant "I have an app.config file". Thanks...
jchapa
Finally got it. I hadn't setup proper IOC. I'm marking as answered because of your connection string help.Thanks!
jchapa
That's good news.
Nissan Fan
A: 

First of all, make sure that the Windows Firewall (and any other firewall software) on that machine is configured to allow incoming connections to SQL Server. See here for instructions.

Second, check that the SQL Server Browser service in the database server machine is running. This is not necessary in all the connection scenarios, so you may need to provide more details. For example, are you using default listen ports for your server?

CesarGon