我有一个控制台应用程序正在测试NAudio库,下面的代码在我的本地计算机和测试服务器上工作正常,但在生产服务器上抛出错误
音频文件是.m4a文件
class Program
{
static void Main(string[] args)
{
string audioPath = ConfigurationManager.AppSettings["AudioFile"];
Console.WriteLine(new AudioFileReader(audioPath).TotalTime.TotalMilliseconds);
Console.ReadLine();
}
}
错误消息
System.Runtime.InteropServices.COMException: No suitable tr
ansform was found to encode or decode the content. (Exception from HRESULT: 0xC0
0D5212)
at NAudio.MediaFoundation.IMFSourceReader.SetCurrentMediaType(Int32 dwStreamI
ndex, IntPtr pdwReserved, IMFMediaType pMediaType)
at NAudio.Wave.MediaFoundationReader.CreateReader(MediaFoundationReaderSettin
gs settings)
at NAudio.Wave.MediaFoundationReader.Init(MediaFoundationReaderSettings initi
alSettings)
at NAudio.Wave.MediaFoundationReader..ctor(String file)
at NAudio.Wave.AudioFileReader.CreateReaderStream(String fileName)
at NAudio.Wave.AudioFileReader..ctor(String fileName)
at NAudioTest.Program.Main(String[] args) in C:\Users\staff\source\repos\NAud
ioTest\NAudioTest\Program.cs:line 15
有关可能导致此错误的任何建议?