0

In web.config of the application, i have the connection string like this. This piece works great and connects to the database fine when i try to debug in the server. But when i go live of the website and try, it does not connect. Is there something i am missing in this part of the code. Help is really appreciated!! Thank you! This is in Visual Studio 2008.

<add key="ConnectionString" value="Server=100.12.222.44;Database=Database1;Integrated Security=SSPI" />
1
  • 1
    When working on development it probably uses your credentials to log in. When in production it will be trying to use the credentials of the application on the web server. Probably best to setup a sql login for granular control over the account. Commented Jul 11, 2013 at 1:21

2 Answers 2

1

I've re-added my answer as a moderator deleted it as I want to stress that luke2012's suggestion of using a SQL login to get around the issue defeats the whole point of Windows Authentication, which is to NOT require credentials to be stored...

Creating a SQL login is bad practice. What you need to do is have the web application connecting to the database via windows authentication. There are various mathods you could look at including impersonation etc..., but the simplest would probably be to run the application under a service account and give that account the permissions it needs connect to the database (minimum permissions required mind you).

Sign up to request clarification or add additional context in comments.

Comments

0

You don't describe the error you're seeing, or whether or not your 'live' site is on a third machine (between your client/browser and your database server), but it's possible you have a delegation problem.

Unless you configure Kerberos delegation, the database server will see the credentials of the identity running the application pool on your web server, rather than those of your client.

There's some technical detail here: http://blogs.technet.com/b/askds/archive/2008/06/13/understanding-kerberos-double-hop.aspx

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.