Scheduling C# app throughts Webclient exception -
i have developed c# application download zip file site, when manually run app, job , exits, when schedule run automatically using task scheduler in windows, throws web client exception error. please me regarding this
the part of code downloading file is
webclient wc = new webclient(); wc.downloadfile(<site>, "feed.zip"); system.diagnostics.processstartinfo pinfo = new system.diagnostics.processstartinfo("extract.bat"); system.diagnostics.process process = new process(); pinfo.createnowindow = true; pinfo.workingdirectory = directory.getcurrentdirectory(); process.startinfo = pinfo; process.start(); process.waitforexit();
the batch file extracts zip file.
i see these possible problems:
- if run application
directory.getcurrentdirectory()
result in different path.directory.getcurrentdirectory()
setbin
-folder, in production environment, can point every, depending how process executed (for example: if create shortcut on desktop, can modifystart in
-folder. - if current directory configured wrong, application not able find
extract.bat
. - while debugging have rights on outputfolder. when application executed batch process, runs under different account. account have rights write output folder?
- the website accessing might require valid account. possibly have valid account. account application running in production, might not valid account website.
- you possibly behind proxy. perhaps need configure settings getting past proxy. in account, these settings configured inside internet explorer. perhaps production account not have these settings configured.
Comments
Post a Comment