there are several possible issues
1) login failure - app pool account does not have access
2) invalid connection string - syntax error
3) firewall rules block access
4) sqlserver not configured for remote access
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Published aspnet website fails to connect to the sql server database using IIS, i am using local host.
there are several possible issues
1) login failure - app pool account does not have access
2) invalid connection string - syntax error
3) firewall rules block access
4) sqlserver not configured for remote access
Hi @Lerato_Dev ,
Please show more information about fail connection. Screenshoots, error code and error message.
In most cases, the connection problems I have encountered are caused by permissions. So please check if the application pool is set to have permission to access the database. You can set permissions according to the following steps.
cd C:\Program Files\Microsoft SQL Server\xxx\Tools\Binn
. Find sqllocaldb.exe
. sqllocaldb.exe create xxxx
. sqllocaldb.exe share xxxx
. sqllocaldb.exe start xxxx
. (LocalDb)\.\xxxx
, select security-logins, right click to add a user. IIS APPPOOL\application pool name
, windows authentication, check public and sysadmin in server role, and create a new login name NT AUTHORITY\SYSTEM
in the same way. If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Bruce Zhang