Permissions issue attempting to connect to SQL DB from ASP.NET

  • Full disclosure. I'm using SQL Express 2012 but this is a newb question so I posted it here. If it needs to be moved, no problem.

    I have SQL Express installed on a server and I'm trying to connect to it from my desktop using ASP.NET.

    I attempted using a SQL user to connect and I get the following error:

    "Login failed for user 'local-sql-user'."

    I am 100% certain I have the username/password correct. In fact, I created a couple different new users to make sure I didn't fat-finger the password somewhere. I have a SIEM that allows me to see traffic going to that server and I am 100% positive this isn't being blocked by a firewall. The local Windows firewall is also disabled on the server.

    Here is my connection string in the web.config file.

    <add name="cs" connectionString="server=LOCAL-IP.\SQLEXPRESS;database=db;uid=local-sql-user;password=p@ssw0rd;" />

    I've also attempted to use an Active Directory account. It's the same account I use for Windows auth when logging in to the SQL Management Studio on the server. It should have God access to everything. I receive the following error using that account:

    "Cannot open database \"Db\" requested by the login. The login failed.Login failed for user 'Domain Account"

    Here is the connection string for that account.

    <add name="cs" connectionString="Data Source=LOCAL-IP.\SQLEXPRESS;Initial Catalog=Db;Integrated Security=SSPI;" />

    I have turned on Named Pipes, remote connections, TCP/IP in the configuration manager. I've given both accounts db_owner roles. I've given NT AUTHORITY/SYSTEM db_owner.

    I'm at a loss. It's been several years since I last did development work but I don't ever recall having this problem.

    Any suggestions would be greatly appreciated.

  • Just to start with and to make sure your login actually works with your SQL . Try to connect to your server

    LOCAL-IP.\SQLEXPRESS with SQL login as local-sql-user and password=p@ssw0rd

    Now , are you able to connect to SQL successfully and able to access the database mapped in ASP.net

  • Turns out I didn't have mixed auth turned on. I only had Windows enabled, so I switched to mixed and it worked.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply