0

I'm a total n00b when it comes to SQL Server admin stuff, so sorry if this is basic. I've designed a website in C#/asp.net with a SQL Server backend on my local machine. Runs perfectly when I open the site through VS2010 and run it. However, when I publish it to IIS and try to run the site, the ASPX works fine but it can't connect to the data. The dropdowns are empty, and anything that deals with data (including logins) doesn't connect to the tables.

I'm assuming this has something to do with permissions? Can anyone help me?

I'm using SQL Server 2008 R2 and Visual Studio 2010, both on a WinXP machine (yeah, I know WinXP isn't built for this, but I just want to test this out before I upload it to a server I have to pay for).

Johnny Bones
  • 117
  • 1
  • 7

1 Answers1

0

Did you check the web.config file to see to which database server is it connecting to. Check if the Database server name is 'localhost'. If it is so, change it to the correct server name. Also, check if the tables have data in them.

Thanks, San.

  • Database server name is not localhost, and the tables have data in them. The dropdowns get populated when I run it from VS, but not when I run it from 192.168.1.1 (which is the internal IP address of my computer). My connection string is: – Johnny Bones Jan 06 '16 at 11:49
  • @JohnnyBones Are you getting any error messages from your application, such as the database not being reached? I notice you are using Integrated Security. It could be a mixup with Windows credentials between machines. You could create a SQL user account for that particular database, assign the appropriate permissions and then use that in your connection string. – Cody Hicks Jan 07 '16 at 17:14
  • @CodyHicks - No visible errors, but it's got to be something in the connection since it works fine from within Visual Studio. I'm going to tinker with the connection string. I have no idea how to set up an account on SQL Server, I know just enough to get it up and running. – Johnny Bones Jan 07 '16 at 18:19
  • @JohnnyBones You could check http://www.connectionstrings.com/sql-server/ as a reference. To set up a user in SQL (system user to be used by applications if youd like).. Open SQL Server Management Studio, point to your SQL server instance.. Open the 'security' folder and then the 'Logins' folder. right-click the 'Logins' folder to add a new login. From there, you can add the login, point to the particular database you want the login to have permissions for etc. – Cody Hicks Jan 07 '16 at 18:44
  • 1
    @CodyHicks - Just getting back to this but you were right. Once I set up a new login, it worked fine. Thanks! – Johnny Bones Feb 08 '16 at 20:46
  • @JohnnyBones Awesome, you bet. Although you can use windows credentials, I've just gotten into a habit of using SQL service accounts to avoid sticky situations like user permissions or the account not being on the same machine / domain, etc. Just something to keep in mind. Good luck! – Cody Hicks Feb 08 '16 at 20:52