2016-03-08 118 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> 

我希望這有助於某人。