c# - ASP.NET CORE: Database Connection Issue (SQLite) in Production -
os: linux, centos proxy: apache asp.net core 1.1
problem: got moment app when decided deploy on real server.
so worked , works fine on local machine. have no issues.
but when published , uploaded server doesn’t work way expected. , mean database (sqlite). the app reads data db supposed to, whenever there await _db.savechangesasync() in code app crashes.
i have searched on internet , didn’t me.
so far have 3 different exceptions:
sqlite error 8: ‘attempt write readonly database’.
i changed permissions of db file 777 folder self, doesn’t help.
got this: sqlite error 14: ‘unable open database file’.
when tried add configure:
app.useforwardedheaders(new forwardedheadersoptions { forwardedheaders = forwardedheaders.xforwardedfor | forwardedheaders.xforwardedproto });
got exemption: warn: microsoft.aspnetcore.httpoverrides.forwardedheadersmiddleware[1] parameter count mismatch between x-forwarded-for , x-forwarded-proto.
connection string :
"defaultconnection": "data source=globalevent.db"
the problem in wrong reverse proxy settings. couldn't find correct solution apache, changed nginx. honest love more. works. also, created nginx server blocks subdomains. else above still applies.
here conf file asp.net core app:
server { listen 80; root /var/www/subdomain.domain.com/html; server_name subdomain.domain.com www.subdomain.domain.com; location / { proxy_pass http://localhost:5000; proxy_http_version 1.1; proxy_set_header upgrade $http_upgrade; proxy_set_header connection keep-alive; proxy_set_header host $host; proxy_cache_bypass $http_upgrade; } }
Comments
Post a Comment