NAudio in Windows Azure /Windows Server 2008 R2

后端 未结 2 785
醉梦人生
醉梦人生 2021-01-17 02:16

I am using NAudio to merge a few mp3 files together for a Windows Azure product. It works fine in the dev environment but once i upload it to Azure, I get the \"No Drive Cal

2条回答
  •  梦毁少年i
    2021-01-17 02:45

    I battled this myself, and these are the steps to follow:

    Manually:

    1. Via Server Manager you can add the Windows Feature "Desktop experience"
    2. Reboot the server as requested (you must for it to take effect)
    3. You can now use the regular Mp3 audio codec NAudio uses (you don't need the Dmo one)

    Automatically (Azure deployments):

    Add these commands to a Startup.cmd startup task in Azure for your role:

    echo Begin Install Desktop Experience Feature (for sound codec) >> startup.log
    ServerManagerCMD.exe -install Desktop-Experience -restart -resultPath     desktopexperience_results.xml
    REM This return code indicates the feature is already installed. Reset the errorlevel to zero using the verify command.
    IF %ERRORLEVEL% EQU 1003 (
        echo Windows feature is already installed >> startup.log
        VERIFY > NUL
    )
    echo End Install Desktop Experience Feature >> startup.log
    

    Note that it is important this script returns a result code (%ERRORLEVEL%) of zero (which the above will do, bar any actual problems).

    The ServerManagerCMD will return a non-zero error code when it does not need to install the feature (perhaps because it was already installed from a previous Startup.cmd run), so we explicitly need to check for that code (1003) and silence it using VERIFY > NUL.

提交回复
热议问题