ASP.net VB文件上传崩溃应用程序

时间:2015-09-02 13:33:28

标签: asp.net vb.net

我不是VB开发人员或ASP.net开发人员。但我需要创建一些简单的上传功能来集成到现有的应用程序中。

aspx文件

<div>
<form id="form1" runat="server">
<asp:FileUpload ID="fileUp" runat="server" />
<br />
<asp:Label ID="Label1" runat="server"></asp:Label>
<br />
<asp:Button ID="uploadButton" runat="server" Text="Upload" />
</form>
</div>

aspx.vb文件

Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls

Namespace MyApp
    Partial Class uploadPage
        Protected Sub upload_click(ByVal sender As Object, ByVal e As System.EventArgs) Handles uploadButton.Click
            If fileUp.HasFile Then
                Try
                    fileUp.SaveAs("C:\Uploads\" & fileUp.FileName)    
                Catch ex As Exception
                    Label1.Text = "ERROR: " & ex.Message.ToString()
                End Try
            Else
                Label1.Text = "You have not specified a file."
            End If
        End Sub
    End Class
End Namespace

当文件上传时会暂停,然后页面被重定向到错误消息“此网页不可用”,我需要重新启动IIS。任何人都可以提供有关如何排除故障的建议吗?

Windows错误日志:

Faulting application name: w3wp.exe, version: 7.5.7601.17514, time stamp: 0x4ce7afa2
Faulting module name: clr.dll, version: 4.0.30319.1, time stamp: 0x4ba21eeb
Exception code: 0xc00000fd
Fault offset: 0x0000000000005e98
Faulting process id: 0xa14
Faulting application start time: 0x01d0e58b87ac8670
Faulting application path: c:\windows\system32\inetsrv\w3wp.exe
Faulting module path: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Report Id: cc6db860-517e-11e5-b0b2-001c42dfc404

0 个答案:

没有答案