0

I have PostgreSql running on my pc.

I want to backup database using pg_dump.

I can backup the database to a specific file with a winform application.

string pgdump = @"c:\Program Files\PostgreSQL\13\bin\pg_dump.exe";
            string arguments = @"-U postgres -Fc -d dbname -v -f c:\backup\file.backup";
            Process proc = new Process { StartInfo = new ProcessStartInfo(pgdump, arguments) };
            proc.Start();
            proc.WaitForExit();

But when i want to do the same thing in a asp.net mvc project, just changing the directory for the file to a directory which i have access

@" -U postgres -Fc -d dbname -v -f C:\inetpub\wwwroot\ReportDir\file.backup

I can see pg_dump starts on task manager and also it creates the specific file with 0Kb but does not continue and finish backing up.

I think that on web project the user doesn't have the right to access the database, but don't know how to fix it?

How can I solve the access problem? Thanks

İlker

Ilker Eker
  • 101
  • 9
  • I find the solution from this page: https://stackoverflow.com/questions/72614188/how-to-pass-password-standardinput-to-pg-dump In desktop version, i keep un/pwd in Users\x\AppData\Roaming\postgresql\pgpass.conf file, but in web version, it can not access that file, so i add un/pwd as in this reference page – Ilker Eker Dec 01 '22 at 13:34

0 Answers0