Possible reasons are:
When accessing your IIS, the default user ASPNET is used, and your SQLSERVER is configured as a trusted connection, but this user is not added to SQLSERVER.
There are two solutions:
1 Do not use a trusted connection, but in the connection string Specify user name and password.
2 Add ASPNET user to security\login in SQLSERVER, and specify read, write and other permissions
recommended 1.