Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 未处理COMException Visual Basic 2010错误_Vb.net_Visual Studio - Fatal编程技术网

Vb.net 未处理COMException Visual Basic 2010错误

Vb.net 未处理COMException Visual Basic 2010错误,vb.net,visual-studio,Vb.net,Visual Studio,我在运行代码时收到以下错误消息 Private Sub submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles submit.Click 'Determine Text Inpu' Dim IEApp As SHDocVw.InternetExplorer Dim IEDoc As Object Dim PREURL A

我在运行代码时收到以下错误消息

Private Sub submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles     submit.Click
        'Determine Text Inpu'
        Dim IEApp As SHDocVw.InternetExplorer
        Dim IEDoc As Object
        Dim PREURL As String
        Dim LocalFileName As String
       Dim errcode As Long
       IEApp = CreateObject("InternetExplorer.Application")
            With IEApp
                .Visible = False
                .Navigate("http://mfreport.paho.org/barr/Default.asp")
                Do While .Busy : Application.DoEvents() : Loop
            Do **While .ReadyState <> 4** : Application.DoEvents() : Loop
                With .Document.Forms("RptForm")
                    .JobName.Value = job.Text
                    .UsrName.Value = user.Text
                    .JobDate.Value = dtp.Text
                    .Submit()
                    .Action.click()
                End With
               Do While Not CBool(InStr(1, .Document.url, "mfreport.paho.org/barr/Default.asp"))
                   Application.DoEvents()
               Loop
               Do While .Busy : Application.DoEvents() : Loop
            Do While .ReadyState <> 3 : Application.DoEvents() : Loop
           End With
           IEDoc = IEApp.Document
           For i = 0 To IEDoc.Links.Length - 1
                  Dim sFullImageURL As String = "http://mfreport.paho.org/barr/JobReceived/" & IEDoc.Links(i).nameProp
            Dim sLocalFileName As String = "I:\SYS_Systems\Support\Test\" & IEDoc.Links(i).nameProp
            Dim MyWebClient As New WebClient
            Call MyWebClient.DownloadFile(sFullImageURL, sLocalFileName)
        Next i
    If errcode = 0 Then
        MsgBox("Download has Completed")
    Else
        MsgBox("An error has occurred")
    End If
    IEApp = Nothing
End Sub
Private Sub submit\u Click(ByVal sender作为System.Object,ByVal e作为System.EventArgs)处理提交。单击
'确定文本输入'
Dim IEApp作为SHDocVw.InternetExplorer
Dim IEDoc作为对象
作为字符串的Dim PREURL
将LocalFileName设置为字符串
将错误代码设置为尽可能长
IEApp=CreateObject(“InternetExplorer.Application”)
使用IEApp
.Visible=False
.导航(“http://mfreport.paho.org/barr/Default.asp")
Do While.Busy:Application.DoEvents():循环
Do**While.ReadyState 4**:Application.DoEvents():循环
带.Document.Forms(“RptForm”)
.JobName.Value=作业.Text
.UsrName.Value=user.Text
.JobDate.Value=dtp.Text
.提交()
.Action.click()
以
不要使用CBool(InStr(1,.Document.url,“mfreport.paho.org/barr/Default.asp”))
Application.DoEvents()
环
Do While.Busy:Application.DoEvents():循环
Do While.ReadyState 3:Application.DoEvents():循环
以
IEDoc=IEApp.Document
对于i=0到IEDoc.Links.Length-1
Dim sFullImageURL作为字符串=”http://mfreport.paho.org/barr/JobReceived/“&IEDoc.Links(i).nameProp
Dim sLocalFileName为String=“I:\SYS\u Systems\Support\Test\”&IEDoc.Links(I).nameProp
将MyWebClient设置为新WebClient
调用MyWebClient.DownloadFile(sfullmageurl,sLocalFileName)
接下来我
如果errcode=0,则
MsgBox(“下载已完成”)
其他的
MsgBox(“发生错误”)
如果结束
IEApp=无
端接头

在debbug中运行此程序时,我收到以下错误消息:COMException未处理RPC服务器不可用。来自HRESULT的异常:0X800706BA

异常发生在哪一行?它将是第13行“Do While.ReadyState 4:Application.DoEvents():Loop”。这可能会有帮助:。虽然这是一般性的(并回答了有关Azure的问题),但它可能有助于隔离问题供您解决。我不确定这是否是问题的原因,因为我可以在本地计算机上使用提升的权限在调试中运行此功能,但在部署应用程序时,我仍然会遇到错误