ASP.Net VB.Net のバックスラッシュは運が悪いようです。
ffprobe を使用してファイルに関する情報を出力しようとしていますが、バックスラッシュを含むすべての文字列のバックスラッシュでパスがランダムに切断されます。
この関数をデバッグして、fileToProcess によって生成されたパスを返します。
Function ffprobe_show_format(ByVal arg As String) As String
Dim myProcess As New System.Diagnostics.Process()
Dim fileToProcess As String = MapPath(".") & "\temps\" & arg
myProcess.StartInfo.FileName = MapPath(".") & "\ffprobe.exe"
myProcess.StartInfo.Arguments = "-show_format " & fileToProcess & " >C:\inetpub\vhosts\mysite.com\httpdocs\absolutefs\ffmpegtemp.txt"
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.RedirectStandardInput = True
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.Start()
Dim myStreamWriter As StreamWriter = myProcess.StandardInput
Dim mystreamreader As StreamReader = myProcess.StandardOutput
Dim str As String = mystreamreader.ReadToEnd
Return str & ";" & "FileToProcess=" & fileToProcess & "MapPath(.) AND ffprobe.exe" & MapPath(".") & "\\ffprobe.exe"
End Function
そして、それは戻ります;FileToProcess=C:
だということだ
- エラーが発生したため、ファイルが処理されません
- My Path はバックスラッシュでカットされています
- その後、文字列の残りの部分が壊れます
別の方法でバックスラッシュを表すように asp.net に指示する必要がありますか?
[編集]
答えを選択することはできませんが、2 つの間違いを犯したため、賛成票を投じます:いくつかの文字。
私は ASP.Net を初めて使用するので、適切なデバッグ方法を見つけるのが困難です。そのため、プラットフォームでデバッグできない場合は、最終的にいつものように作成しました。デバッグ変数をテキスト ファイルに書きました。
Function ffprobe_show_format(ByVal file As String, ByVal app As String) As String
Dim myProcess As New System.Diagnostics.Process()
myProcess.StartInfo.FileName = app
Dim argz As String = FormatCommandLine("-show_format", file)
myProcess.StartInfo.Arguments = argz
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.Start()
Dim mystreamreader As StreamReader = myProcess.StandardOutput str As String = mystreamreader.ReadToEnd
MapPath(".") & "/ffprobe.exe"
Dim objWriter As New System.IO.StreamWriter(MapPath(".") & "\debug.txt")
objWriter.Write(str)
objWriter.Close()
Return str
End Function
それを呼び出してファイルを処理する方法の別の例でもあるので、ffmpeg タグを追加します。