Forum Moderators: open

Message Too Old, No Replies

Help! ASP connection string wont' work with IIS7

Moving to new hosting company

         

dickbaker

12:20 am on Jun 6, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I hope someone here can help me with a problem. I have many, many .asp pages that use connection strings that are on .asp pages. This has worked just fine for over seven years, and through various types of servers, the last being a VPS with IIS4 (or was it 5?).

Anyway, I'm moving my site to a Cloud server running IIS7, and I'm getting 500 errors. I brought the databases into Enterprise Manager, and I'm able to run queries on that, so the databases are fine.

The problem is the connection strings, and I can't seem to find any that work. The hosting company (well-known and very well-respected) doesn't have any coders as such, and so they'll be of limited help.

Here's an example of a simple connection string I've tried. It's not much different than the string I'm using on the VPS.

"Provider=SQLNCLI10;Server=MyServerIP;Database=myDatabase;Uid=MyID; Pwd=APassword;"

Any ideas what I could be doing wrong?

Replies are very, very much appreciated.

Ocean10000

5:33 am on Jun 6, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Only thing that stands out to me is the provider you choose is for Sql Server 2008 and up only. Are they running an older version of Sql server for you?

SQL Server 2008 R2 Native Client (OLE DB) [msdn.microsoft.com]

dickbaker

2:18 pm on Jun 6, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi, Ocean10000. The SQL Server Management Studio login shows SQL 2008 R2. I don't see any mention of native client.

To be honest, I don't know what it is you're referring to. They're using my database from my old hosting company, which is a 2005 WordGroup database. The old server is a 2003.

Beyond that, I'm an idiot.

I can see the database in the Management Studio, and can run queries, so I know the database isn't corrupt. I've read articles about how the connection strings are to be set up in the web.config file in the root folder, and how this is to be configured in IIS7.

What I can't figure out is where in the code on a particular page (widgets.asp, for example) is the reference to the connection. Right now the pages have <!--#include file="Connections/connections.asp" -->

Ocean10000

2:47 pm on Jun 6, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi, dickbaker, I determined you were using the native client by this little string "Provider=SQLNCLI10". I looked it up and found it was the Native Client string.

If you are using Asp.Net the connection strings are setup in the web.config by default normally.

If you are using Classic Asp the connection strings are normally stored in the code it self someplace.

This file listed below is where you should look to change the connection string. I am guessing it still using the old connection string from your previous host.
<!--#include file="Connections/connections.asp" -->

dickbaker

4:35 pm on Jun 6, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for the reply. Right now the include file for connections references a file in the connections folder called "connections.asp".

If I'm to use the connection string I created that's now in the web.config file, what do I put in the source code of each page that needs a connection string? Or does the page need to explicitly reference the connection string in the web.config file?

What I'm trying to figure out is how the query in the source code knows how to connect to the database.

Ocean10000

5:01 pm on Jun 6, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I can only speak how I setup Classic Asp sites. I normally did do one include to setup the connection object used by the rest of my database code. From the descriptions you have put this would mean editing "connections.asp" file and looking for the actual connection generating code and updating it accordingly.