Saturday, February 25, 2012

Connection Error

What the problem of this error. For information, please check code as below,

ProtectedConst SQL_CONNECTION_STRINGAsString = "workstation id=LOCALHOST; size=4096;integrated security=SSPI;initial catalog=VIVAM;persist security info=False;User ID=sa"

below is the error command

Login failed for user 'BST-FAIROZ\ASPNET'.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.Data.SqlClient.SqlException: Login failed for user 'BST-FAIROZ\ASPNET'.

As you set integrated security to SSPI in connection string, you're using Windows Authentication to connnect to SQL. So when the application is deployed to IIS5.0, IIS will use'BST-FAIROZ\ASPNET'account to connect to SQL. So what you need to do is add the account in SQL logins: open Management Studio (or Enterprise Manager)-> locate local SQL instance->Security->Logins->New Login. And give sufficient permissions to the account so that your application can perform query to SQL as you like.

No comments:

Post a Comment