質問編集履歴

2

プログラムを「```」バックコード3つで囲みました

2023/04/03 04:49

投稿

kishidamisao
kishidamisao

スコア12

test CHANGED
File without changes
test CHANGED
@@ -51,7 +51,7 @@
51
51
  at WpfApp1.App.Main()”
52
52
 
53
53
  プログラム
54
- //HttpWebRequestの作成
54
+ ``` //HttpWebRequestの作成
55
55
  System.Net.HttpWebRequest webreq = (System.Net.HttpWebRequest)
56
56
  System.Net.WebRequest.Create(filePath);
57
57
  //CredentialCacheの作成
@@ -101,4 +101,4 @@
101
101
  }
102
102
  return err_flg;
103
103
  }
104
-
104
+ ```

1

コートを上下し、開発環境を記載しました。

2023/04/03 03:09

投稿

kishidamisao
kishidamisao

スコア12

test CHANGED
File without changes
test CHANGED
@@ -2,8 +2,56 @@
2
2
  バイナリデータをダウンロードして保存している部分で以下のエラーが出てプログラムが
3
3
  終了してしまいます。
4
4
  修正方法をご存知の方がいましたらご教授ください。
5
+ 「Windows 10 の Visual Studio 2022 で Windows Forms アプリをターゲットフレームワーク .NET Framework 7.0 で作っています。」
6
+
7
+ エラー内容
8
+ ”Application:xxxx.exe
9
+ CoreCLR Version: 7.0.423.11508
10
+ .NET Version: 7.0.4
11
+ Description: The process was terminated due to an unhandled exception.
12
+ Exception Info: System.IO.IOException: Unable to read data from the transport connection: 接続済みの呼び出し先が一定の時間を過ぎても正しく応答しなかったため、接続できませんでした。または接続済みのホストが応答しなかったため、確立された接続は失敗しました。.
13
+ ---> System.Net.Sockets.SocketException (10060): 接続済みの呼び出し先が一定の時間を過ぎても正しく応答しなかったため、接続できませんでした。または接続済みのホストが応答しなかったため、確立された接続は失敗しました。
14
+ at System.Net.Sockets.NetworkStream.Read(Span`1 buffer)
15
+ --- End of inner exception stack trace ---
16
+ at System.Net.Sockets.NetworkStream.Read(Span`1 buffer)
17
+ at System.Net.Security.SslStream.EnsureFullTlsFrameAsync[TIOAdapter](CancellationToken cancellationToken)
18
+ at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
19
+ at System.Net.Security.SslStream.ReadAsyncInternal[TIOAdapter](Memory`1 buffer, CancellationToken cancellationToken)
20
+ at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
21
+ at System.Net.Security.SslStream.Read(Byte[] buffer, Int32 offset, Int32 count)
22
+ at System.IO.Stream.Read(Span`1 buffer)
23
+ at System.Net.Http.HttpConnection.Read(Span`1 destination)
24
+ at System.Net.Http.HttpConnection.ContentLengthReadStream.Read(Span`1 buffer)
25
+ at System.Net.Http.HttpBaseStream.Read(Byte[] buffer, Int32 offset, Int32 count)
26
+ at WpfApp1.MainWindow.ReadBinaryData(Stream st) in C:\Users\xxxx\wpf20210528_2021060151000\WpfApp1\MainWindow.xaml.cs:line 1539
27
+ at WpfApp1.MainWindow.str_readimge(String filePath, String userName, String userPassword, String outPath) in C:\Users\xxxx\WpfApp1\MainWindow.xaml.cs:line 1604
28
+ at WpfApp1.MainWindow.InitializeAsync() in C:\Users\xxx\WpfApp1\MainWindow.xaml.cs:line 347
29
+ at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
30
+ at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
31
+ at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
32
+ at System.Windows.Threading.DispatcherOperation.InvokeImpl()
33
+ at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
34
+ at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
35
+ --- End of stack trace from previous location ---
36
+ at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
37
+ at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
38
+ at System.Windows.Threading.DispatcherOperation.Invoke()
39
+ at System.Windows.Threading.Dispatcher.ProcessQueue()
40
+ at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
41
+ at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
42
+ at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
43
+ at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
44
+ at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
45
+ at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
46
+ at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
47
+ at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
48
+ at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
49
+ at System.Windows.Application.RunDispatcher(Object ignore)
50
+ at System.Windows.Application.RunInternal(Window window)
51
+ at WpfApp1.App.Main()”
52
+
5
53
  プログラム
6
- //HttpWebRequestの作成
54
+ //HttpWebRequestの作成
7
55
  System.Net.HttpWebRequest webreq = (System.Net.HttpWebRequest)
8
56
  System.Net.WebRequest.Create(filePath);
9
57
  //CredentialCacheの作成
@@ -53,50 +101,4 @@
53
101
  }
54
102
  return err_flg;
55
103
  }
56
-
57
- エラー内容
104
+
58
- Application:xxxx.exe
59
- CoreCLR Version: 7.0.423.11508
60
- .NET Version: 7.0.4
61
- Description: The process was terminated due to an unhandled exception.
62
- Exception Info: System.IO.IOException: Unable to read data from the transport connection: 接続済みの呼び出し先が一定の時間を過ぎても正しく応答しなかったため、接続できませんでした。または接続済みのホストが応答しなかったため、確立された接続は失敗しました。.
63
- ---> System.Net.Sockets.SocketException (10060): 接続済みの呼び出し先が一定の時間を過ぎても正しく応答しなかったため、接続できませんでした。または接続済みのホストが応答しなかったため、確立された接続は失敗しました。
64
- at System.Net.Sockets.NetworkStream.Read(Span`1 buffer)
65
- --- End of inner exception stack trace ---
66
- at System.Net.Sockets.NetworkStream.Read(Span`1 buffer)
67
- at System.Net.Security.SslStream.EnsureFullTlsFrameAsync[TIOAdapter](CancellationToken cancellationToken)
68
- at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
69
- at System.Net.Security.SslStream.ReadAsyncInternal[TIOAdapter](Memory`1 buffer, CancellationToken cancellationToken)
70
- at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
71
- at System.Net.Security.SslStream.Read(Byte[] buffer, Int32 offset, Int32 count)
72
- at System.IO.Stream.Read(Span`1 buffer)
73
- at System.Net.Http.HttpConnection.Read(Span`1 destination)
74
- at System.Net.Http.HttpConnection.ContentLengthReadStream.Read(Span`1 buffer)
75
- at System.Net.Http.HttpBaseStream.Read(Byte[] buffer, Int32 offset, Int32 count)
76
- at WpfApp1.MainWindow.ReadBinaryData(Stream st) in C:\Users\xxxx\wpf20210528_2021060151000\WpfApp1\MainWindow.xaml.cs:line 1539
77
- at WpfApp1.MainWindow.str_readimge(String filePath, String userName, String userPassword, String outPath) in C:\Users\xxxx\WpfApp1\MainWindow.xaml.cs:line 1604
78
- at WpfApp1.MainWindow.InitializeAsync() in C:\Users\xxx\WpfApp1\MainWindow.xaml.cs:line 347
79
- at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
80
- at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
81
- at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
82
- at System.Windows.Threading.DispatcherOperation.InvokeImpl()
83
- at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
84
- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
85
- --- End of stack trace from previous location ---
86
- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
87
- at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
88
- at System.Windows.Threading.DispatcherOperation.Invoke()
89
- at System.Windows.Threading.Dispatcher.ProcessQueue()
90
- at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
91
- at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
92
- at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
93
- at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
94
- at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
95
- at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
96
- at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
97
- at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
98
- at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
99
- at System.Windows.Application.RunDispatcher(Object ignore)
100
- at System.Windows.Application.RunInternal(Window window)
101
- at WpfApp1.App.Main()
102
-