2016-03-08 121 views
0

我已经编写了一个使用AWS S3 .NET SDK上传文件的小型上传器。它可以在我的电脑上正常工作。当我在两台客户端计算机上尝试它时,它会引发异常。我的开发计算机和客户端计算机正在运行Windows 7.我尝试了其他几台计算机,该程序工作正常。这是一个非常简单的程序,读取一个文件并调用SDK API来上传它。我得到的例外是:将文件上传到S3 .Net SDK时出现异常

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

研究了很多之后,发现我得到的异常是未捕获的异常。这个异常与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的请求!需要以默认登录用户身份登录到代理服务器。为此,您将以下行添加到app.config。

<system.net> 
    <defaultProxy useDefaultCredentials=”true”> </defaultProxy> 
</system.net> 

我希望这有助于某人。