IIS app does not have permissions to access an SQLite db file

MSCollege3000 160 Reputation points
2024-06-26T05:36:35.3733333+00:00

Running a web api project using IIS debug profile does not allow to access, create or delete SQLite db file located in the app directory. Access denied.

The same is when I publish the project to the IIS inetpub folder and copy the db file there. The web service runs in the browser but it can't even read the db.

How to configure IIS to give it full access?

Windows 10, VS2022, IIS 10, Net Core 8.

Internet Information Services
0 comments No comments
{count} votes

Accepted answer
  1. Sam Wu-MSFT 7,531 Reputation points Microsoft Vendor
    2024-06-28T07:08:36.1066667+00:00

    @MSCollege3000

    You only need to assigne the iis_iusrs and iusr permission to the inetpub folder.


    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.


4 additional answers

Sort by: Most helpful
  1. Olaf Helper 45,121 Reputation points
    2024-06-26T06:20:28.3233333+00:00

    Access denied.

    And where is the SQLite db file located?

    The IIS service/side proxy account needs read/write access permissions on.


  2. Olaf Helper 45,121 Reputation points
    2024-06-26T17:35:34.2633333+00:00

    You didn't gave an answer on my question, nor further detailed informations.

    Again: IIS needs read/write access permissions on.


  3. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  4. MSCollege3000 160 Reputation points
    2024-06-29T14:25:00.9066667+00:00

    Answering my own question.

    IIS cannot access a db file in the app folder because neither the folder nor the db file has any IIS-related account associated with any permissions.

    To grand IIS access to a desired folder or file:

    • Right-click the folder or file, open Properties window, in the Security tab click Edit, then Add,
    • Then if you don't know the exact name of the IIS account, click the Advanced button,
    • Click Find Now
    • In the list of all accounts click IIS_IUSRS and then Ok and Ok, then check all desired permissions for that account and Ok.

    This allows IIS web app to create and modify db file in the folder.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.