我已经编写了一个小型上传器,可以使用AWS S3 .NET SDK上传文件。它在我的电脑上工作正常。当我在两台客户端计算机上尝试它时,它会抛出异常。我的开发机器和客户端机器正在运行Windows 7.我尝试了几台其他计算机,该程序运行正常。这是一个非常简单的程序,读取文件并调用SDK API来上传它。我得到的例外是:
Faulting application name: AWSUploader.exe, version: 1.0.0.0, time stamp: 0x56df54b2
Faulting module name: KERNELBASE.dll, version: 6.1.7601.23313, time stamp: 0x56842940
Exception code: 0xe0434352
Fault offset: 0x0000c44d
Faulting process id: 0x1594
Faulting application start time: 0x01d1798c224555b4
Faulting application path: C:\Users\ama06v\Desktop\Debug\Debug\AWSUploader.exe
Faulting module path: C:\WINDOWS\syswow64\KERNELBASE.dll
Report Id: 602f959e-e57f-11e5-a925-70f39532fcec
Application: AWSUploader.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: Amazon.Runtime.AmazonServiceException
Stack:
at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeSync(Amazon.Runtime.IExecutionContext)
at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(Amazon.Runtime.IExecutionContext)
at Amazon.Runtime.Internal.MetricsHandler.InvokeSync(Amazon.Runtime.IExecutionContext)
at Amazon.Runtime.Internal.RuntimePipeline.InvokeSync(Amazon.Runtime.IExecutionContext)
at Amazon.Runtime.AmazonServiceClient.Invoke[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.__Canon, Amazon.Runtime.Internal.Transform.IMarshaller`2<Amazon.Runtime.Internal.IRequest,Amazon.Runtime.AmazonWebServiceRequest>, Amazon.Runtime.Internal.Transform.ResponseUnmarshaller)
at Amazon.S3.AmazonS3Client.InitiateMultipartUpload(Amazon.S3.Model.InitiateMultipartUploadRequest)
at s3.amazon.com.docsamples.UploadFileMPULowLevelAPI.Main(System.String[])
我已经用AWS开了一张票,他们正在调查它,到目前为止还没有答案。 我正在使用NuGet 3.2.2中的最新AWS SDK
感谢您的帮助。
答案 0 :(得分:0)
经过大量研究后发现,我得到的例外是一个未被捕获的例外。这个例外与KERNELBASE.dll无关,这不是罪魁祸首,虽然它看起来像。所以我为未处理的异常添加了一个处理程序,不知道发生异常的位置如下:
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyHandler);
处理程序
static void MyHandler(object sender, UnhandledExceptionEventArgs args)
{
Exception e = (Exception)args.ExceptionObject;
Console.WriteLine(e);
Console.ReadLine();
}
该处理程序产生了以下异常(截断):
MyHandler caught : A WebException with status ProtocolError was thrown.
Amazon.Runtime.AmazonServiceException: A WebException with status Protocol Error was thrown. ---> System.Net.WebException: The remote server returned an error: (407) Proxy Authentication Required.
at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
at System.Net.HttpWebRequest.GetRequestStream()
at Amazon.Runtime.Internal.HttpRequest.GetRequestContent()
......
......
基本上医院系统有一个代理服务器阻止了我们对AWS的请求!需要以defualt登录用户身份登录代理服务器。为此,您将以下行添加到app.config。
<system.net>
<defaultProxy useDefaultCredentials=”true”> </defaultProxy>
</system.net>
我希望这有助于某人。