0

我正在尝试将上传文件复制到远程服务器,但出现异常。复制一个 100kb 的文件需要 5 分钟。

System.Threading.ThreadAbortException: Thread was being aborted.
   at Microsoft.Win32.Win32Native.CreateFile(String lpFileName, Int32 dwDesiredAccess, FileShare dwShareMode, SECURITY_ATTRIBUTES securityAttrs, FileMode dwCreationDisposition, Int32 dwFlagsAndAttributes, IntPtr hTemplateFile)
   at Microsoft.Win32.Win32Native.SafeCreateFile(String lpFileName, Int32 dwDesiredAccess, FileShare dwShareMode, SECURITY_ATTRIBUTES securityAttrs, FileMode dwCreationDisposition, Int32 dwFlagsAndAttributes, IntPtr hTemplateFile)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at System.Net.Mail.AttachmentBase.SetContentFromFile(String fileName, String mediaType)
   at System.Net.Mail.Attachment..ctor(String fileName)
   at AFI.WarrantyClaim.SendConfirmationMail(String sClaimID, String sRecepient, Boolean bIsCust, ArrayList alUploadedFiles)
   at AFI.WarrantyClaim.btnNext_Click(Object sender, EventArgs e) 

导致此问题的代码:

For i As Integer = 0 To Request.Files.Count - 1
            Dim hpfFile As HttpPostedFile = Request.Files(i)

            If hpfFile.ContentLength > 0 Then
                Dim sFileExtention As String = System.IO.Path.GetExtension(hpfFile.FileName)
                Dim sFileName As String = String.Empty

                sFileName = sClaimNo + "_" + System.IO.Path.GetFileNameWithoutExtension(hpfFile.FileName) + "_" + iPhoto.ToString() + _
                            sFileExtention

                Dim sScopeIdentity As String = SaveImageData(Convert.ToInt32(sClaimNo), Convert.ToString(iPhoto), sFileName)
                hpfFile.SaveAs(ConfigurationManager.AppSettings(m_sUPLOADED_FILE_PATH) + sFileName)


               iPhoto = iPhoto + 1
            End If
        Next
4

1 回答 1

0

看起来操作正在超时....检查您 PC 上的防火墙设置,或检查远程服务器上的日志。

于 2012-06-07T03:35:38.450 回答