Welcome to WebmasterWorld Guest from 34.201.121.213

Forum Moderators: ocean10000

Message Too Old, No Replies

Help! ASP connection string wont' work with IIS7

Moving to new hosting company

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 14, 2003
posts:1783
votes: 0


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.
5:33 am on June 6, 2011 (gmt 0)

Administrator

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month

joined:Jan 14, 2004
posts:864
votes: 3


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]
2:18 pm on June 6, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 14, 2003
posts:1783
votes: 0


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" -->
2:47 pm on June 6, 2011 (gmt 0)

Administrator

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month

joined:Jan 14, 2004
posts:864
votes: 3


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" -->
4:35 pm on June 6, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 14, 2003
posts:1783
votes: 0


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.
5:01 pm on June 6, 2011 (gmt 0)

Administrator

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month

joined:Jan 14, 2004
posts:864
votes: 3


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.