2

I have published my web project to local iis but framework can't find the "db" file. In debugging there is no problem, i can connect but in localhost i can't. Here is my connection string:

<connectionStrings>
    <add name="PROD" connectionString="data source=app.db;" providerName="System.Data.SQLite"/>
  </connectionStrings>

I tried everything "../app.db" "direct_path" "~/app.db"

What might the problem?


It can find the database in D:\ drive or other than inetpub drive. I didn't understand if it's a permission problem or not. How can i find the exact solution for that?

2 Answers 2

3

Well i got the physical path with System.AppDomain.CurrentDomain.BaseDirectory and then find the path of sqlite file. It worked!

Sign up to request clarification or add additional context in comments.

Comments

0

this is most likely a permissions issue. this works while debugging because the website is running under your credentials and you have full control. when deployed it's running under IIS_USRS which is highly restrictive and, most likely, doesn't have write permissions to the file by default.

provide the IIS_USRS account with read/write permissions to the directory/file and this should work.

2 Comments

i gave all the permissions to file / folder but no hope.
data source = |DataDirectory|app.db is my connection string App_Data directory is under bin dir when i publish the project

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.