I want to backup my database using SMO and zip a backup file then upload it to my server. here is my code
// Backup
var conn = new SqlConnection(sqlConnectionString);
var server = new Server(new ServerConnection(conn));
var backupMgr = new Backup();
backupMgr.Devices.AddDevice(file.FullName, DeviceType.File);
backupMgr.Database = dictionary[StringKeys.Database];
backupMgr.Action = BackupActionType.Database;
backupMgr.SqlBackup(server);
// Compress
using (var zip = new ZipFile())
{
zipFile = string.Format("{0}\\{1}.zip", directoryName, DateTime.Now.ToString("yyyyMMddHHmm"));
zip.AddFile(outputPath, "");
zip.Save(zipFile);
}
// uploading code
Size of a backup file can be more than 100MB. But after i zip this using above code, it doesn't reduce the size. So I cannot upload larger zip files. Is there way to reduce the file size with DotNetZip?