개정판 a2a64028
ConvertService Webclient Dispose
Change-Id: I2da15bf6437478fb2724f83139ba2e130ced6da2
ConvertService/ServiceBase/ServiceTestApp/MainWindow.xaml.cs | ||
---|---|---|
554 | 554 |
|
555 | 555 |
private async void DownLoadTest_click(object sender, RoutedEventArgs e) |
556 | 556 |
{ |
557 |
await DownloadFileAsync("http://172.20.110.75:8880/ifweb/external/DLMFileDownload.jsp?objectId=33808.61925.45058.48300&format=Original PDF&fileName=MARKUS_20190731_0001_A.pdf"); |
|
557 |
for (int i = 0; i < 100; i++) |
|
558 |
{ |
|
559 |
await DownloadFileAsync("http://cloud.devdoftech.co.kr:5977/PDF/000000_app/VPCS_DOCLIB/110001/11000102/ToVendor/VP-DRAWINGS-SAMPLE-002.pdf"); |
|
560 |
|
|
561 |
await Task.Delay(new TimeSpan(0,0,0,1)); |
|
562 |
} |
|
563 |
|
|
558 | 564 |
} |
559 | 565 |
|
560 | 566 |
private async Task<bool> DownloadFileAsync(string FileaPath) |
561 | 567 |
{ |
568 |
System.Diagnostics.Stopwatch stopwatch = new Stopwatch(); |
|
569 |
stopwatch.Start(); |
|
570 |
|
|
562 | 571 |
bool result = false; |
563 | 572 |
|
564 | 573 |
try |
... | ... | |
584 | 593 |
//} |
585 | 594 |
|
586 | 595 |
FileaPath = HttpUtility.UrlDecode(FileaPath); //PDF 전체 경로 |
587 |
string FileName = DownloadUri.GetFileName(FileaPath); |
|
596 |
string FileName = System.IO.Path.GetRandomFileName();// DownloadUri.GetFileName(FileaPath); |
|
597 |
|
|
588 | 598 |
|
589 | 599 |
string downloadFilePath = System.IO.Path.Combine(@"c:\temp", FileName); |
590 | 600 |
|
... | ... | |
608 | 618 |
{ |
609 | 619 |
webClient.UseDefaultCredentials = true;//.Headers.Add("Authorization: BASIC SGVsbG8="); //가상의 인증 |
610 | 620 |
|
621 |
webClient.Proxy = null; |
|
622 |
//System.Net.IWebProxy webProxy = webClient.Proxy; |
|
623 |
|
|
624 |
//if (webProxy != null) |
|
625 |
//{ |
|
626 |
// // Use the default credentials of the logged on user. |
|
627 |
// webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials; |
|
628 |
//} |
|
611 | 629 |
//if (!System.IO.Directory.Exists(ConvertProcessContext.TempDirectory)) |
612 | 630 |
//{ |
613 | 631 |
// System.IO.Directory.CreateDirectory(ConvertProcessContext.TempDirectory); |
614 | 632 |
//} |
615 | 633 |
|
634 |
System.Diagnostics.Debug.WriteLine("file download Test"); |
|
616 | 635 |
await webClient.DownloadFileTaskAsync(pdfFileUri, downloadFilePath); |
636 |
System.Diagnostics.Debug.WriteLine("file download Test : " + new TimeSpan(stopwatch.ElapsedTicks)); |
|
637 |
webClient.Dispose(); |
|
617 | 638 |
} |
618 | 639 |
} |
619 |
catch (Exception) |
|
640 |
catch (Exception ex)
|
|
620 | 641 |
{ |
621 | 642 |
throw new Exception("File Download Error. Please, check the file path."); |
622 | 643 |
} |
... | ... | |
626 | 647 |
throw new Exception("Please, check the file path."); |
627 | 648 |
} |
628 | 649 |
|
650 |
System.Diagnostics.Debug.WriteLine("file download Test File.Exists : " + new TimeSpan(stopwatch.ElapsedTicks)); |
|
651 |
|
|
629 | 652 |
if (File.Exists(downloadFilePath)) |
630 | 653 |
{ |
631 | 654 |
var file = File.Open(downloadFilePath, FileMode.Open); |
내보내기 Unified diff