没有应用程序与此操作的指定文件关联(VB.NET)

gch*_*chq 9 vb.net pdf winforms

我们有一个Win Forms应用程序,它生成带有iTextSharp的pdf,将其保存到本地目录,然后应用程序打开该文件.有一个客户(所有XP盒和Adobe Reader 11),它会抛出以下错误

No application is associated with the specified file for this operation
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
Run Code Online (Sandbox Code Playgroud)

这表明Adobe Reader与pdf扩展名没有正确关联,除了他们可以导航到本地目录并打开文件而没有任何问题.

有没有人遇到过这种奇怪之处?

编辑ZippyV - 典型子的例子

 Public Sub PDF_Functions_LogCalls_RunReport(ByVal Customer As Boolean)
    Try
        Dim vOutput As String = LogCalls_Run(Customer)
        If Left(vOutput, 5) = "Error" Then
            TaskDialog.Show(MainForm, AppBoxError("File Error", vOutput, "Error"))
            Exit Sub
        End If
        If System.IO.File.Exists(vOutput) Then
            Dim P As New Process
            P.StartInfo.FileName = vOutput
            P.StartInfo.Verb = "Open"
            P.Start()
        End If
    Catch ex As Exception
        EmailError(ex)
        Exit Sub
    End Try
End Sub
Run Code Online (Sandbox Code Playgroud)

Ken*_*ite 14

您正在阅读错误消息错误.我更加强调相关部分:

没有应用程序与此操作的指定文件关联

这意味着没有与动词"打开"相关联的应用程序.更改您的代码只需使用空字符串(或只是不设置)Verb:

P.StartInfo.FileName = vOutput
P.StartInfo.Verb = ""
P.Start()
Run Code Online (Sandbox Code Playgroud)

这使用.pdf格式的默认操作,它将匹配用户在Windows资源管理器中双击文件时将获得的操作.

最新版本的Acrobat将默认操作设置为"使用Adobe Reader XI打开"而不是"打开",因为您可以看到右键单击.pdf文件.

在Windows资源管理器中看到的Acrobat上下文菜单

这似乎是导致"与此操作无关"错误的原因.