dotnet.exe fail to execute in Azure Web Site
Steps to reproduce
Try to deploy MVC to Azure Web Sites through Kudu. Here's the sample app: https://github.com/troydai/HelloMvcKudu/tree/0950beaa48027a47496bd3426935cf0716f7e9be
Here's the deployment script: https://github.com/troydai/HelloMvcKudu/blob/0950beaa48027a47496bd3426935cf0716f7e9be/deploy.ps1
Expected behavior
The deployment script will execute the dotnet.exe --version. It is expected to be successful.
Actual behavior
The command failed quietly. No exception was thrown and no output was generated. Turn on the trace, here the end portion of it:
remote: Adding to native path: D:\home\site\repository\.dotnet\sdk\1.0.0-beta-001986
remote:
remote: Adding to resources path: D:\home\site\repository\.dotnet\sdk\1.0.0-beta-001986
remote:
remote: Failed to load the dll from D:\home\site\repository\.dotnet\sdk\1.0.0-beta-001986\coreclr.dll, HRESULT: 0x8007007E
remote:
remote: Failed to bind to coreclr
remote:
remote: Tracing enabled
remote:
remote: Own DLL path=[D:\home\site\repository\.dotnet\dotnet.dll]
remote:
remote: Checking if CoreCLR path exists=[D:\home\site\repository\.dotnet\coreclr.dll]
remote:
remote: Host operating in Muxer mode
remote:
remote: --- Executing in muxer mode...
remote:
remote: --- Resolving dotnet from working dir
remote:
remote: Probing path [D:\home\site\repository\global.json] for global.json
remote:
remote: Found global.json [D:\home\site\repository\global.json]
remote:
remote: --- Resolving CLI version from global json [D:\home\site\repository\global.json]
remote:
remote: CLI '/sdk/version' field not present/null in [D:\home\site\repository\global.json]
remote:
remote: --- Resolving SDK version from SDK dir [D:\home\site\repository\.dotnet\sdk]
remote:
remote: Considering version... [.]
remote:
remote: Considering version... [..]
remote:
remote: Considering version... [1.0.0-beta-001943]
remote:
remote: Considering version... [1.0.0-beta-001986]
remote:
remote: No production version found, so using latest prerelease
remote:
remote: Checking if resolved SDK dir [D:\home\site\repository\.dotnet\sdk\1.0.0-beta-001986] exists
remote:
remote: Resolved SDK dir is [D:\home\site\repository\.dotnet\sdk\1.0.0-beta-001986]
remote:
remote: Found CLI SDK in: D:\home\site\repository\.dotnet\sdk\1.0.0-beta-001986
remote:
remote: Using dotnet SDK dll=[D:\home\site\repository\.dotnet\sdk\1.0.0-beta-001986\dotnet.dll]
remote:
remote: Runtime config [D:\home\site\repository\.dotnet\sdk\1.0.0-beta-001986\dotnet.runtimeconfig.json] is valid=[1]
remote:
remote: Executing dotnet.dll as a standalone app as per config file [D:\home\site\repository\.dotnet\sdk\1.0.0-beta-001986\dotnet.runtimeconfig.json]
remote:
remote: Loaded library from D:\home\site\repository\.dotnet\sdk\1.0.0-beta-001986\hostpolicy.dll
remote:
remote:
remote: Error - Changes committed to remote repository but deployment to website failed.
To https://[email protected]:443/trdai-dotnet-001.git
In the scm, execute the dotnet.exe has the same effect:

However when it is executed through the corehost.exe under the sdk folder, it works fine:

Works for build 1986, too:

Full log:
Environment:
ALLUSERSPROFILE=D:\local\ProgramData
APPDATA=D:\local\AppData
APPSETTING_ScmType=LocalGit
APPSETTING_WEBSITE_AUTH_ENABLED=False
APPSETTING_WEBSITE_NODE_DEFAULT_VERSION=4.2.3
APPSETTING_WEBSITE_SITE_NAME=trdai-dotnet-001
APP_POOL_CONFIG=C:\DWASFiles\Sites\#1trdai-dotnet-001\Config\applicationhost.config
APP_POOL_ID=~1trdai-dotnet-001
aspnet:DisableFcnDaclRead=true
aspnet:PortableCompilationOutput=true
aspnet:PortableCompilationOutputSnapshotType=Microsoft.Web.Compilation.Snapshots.SnapshotHelper, Microsoft.Web.Compilation.Snapshots, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
AZURE_JETTY9_CMDLINE=-Djava.net.preferIPv4Stack=true -Djetty.port=%HTTP_PLATFORM_PORT% -Djetty.base="D:\Program Files (x86)\jetty-distribution-9.1.0.v20131115" -Djetty.webapps="d:\home\site\wwwroot\webapps" -jar "D:\Program Files (x86)\jetty-distribution-9.1.0.v20131115\start.jar" etc\jetty-logging.xml
AZURE_JETTY9_HOME=D:\Program Files (x86)\jetty-distribution-9.1.0.v20131115
AZURE_TOMCAT7_CMDLINE=-Dport.http=%HTTP_PLATFORM_PORT% -Djava.util.logging.config.file="D:\Program Files (x86)\apache-tomcat-7.0.50\conf\logging.properties" -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Dsite.logdir="d:/home/LogFiles/" -Dsite.tempdir="d:\home\site\workdir" -classpath "D:\Program Files (x86)\apache-tomcat-7.0.50\bin\bootstrap.jar;D:\Program Files (x86)\apache-tomcat-7.0.50\bin\tomcat-juli.jar" -Dcatalina.base="D:\Program Files (x86)\apache-tomcat-7.0.50" -Djava.io.tmpdir="d:\home\site\workdir" org.apache.catalina.startup.Bootstrap
AZURE_TOMCAT7_HOME=D:\Program Files (x86)\apache-tomcat-7.0.50
AZURE_TOMCAT8_CMDLINE=-Dport.http=%HTTP_PLATFORM_PORT% -Djava.util.logging.config.file="D:\Program Files (x86)\apache-tomcat-8.0.23\conf\logging.properties" -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Dsite.logdir="d:/home/LogFiles/" -Dsite.tempdir="d:\home\site\workdir" -classpath "D:\Program Files (x86)\apache-tomcat-8.0.23\bin\bootstrap.jar;D:\Program Files (x86)\apache-tomcat-8.0.23\bin\tomcat-juli.jar" -Dcatalina.base="D:\Program Files (x86)\apache-tomcat-8.0.23" -Djava.io.tmpdir="d:\home\site\workdir" org.apache.catalina.startup.Bootstrap
AZURE_TOMCAT8_HOME=D:\Program Files (x86)\apache-tomcat-8.0.23
CommonProgramFiles=D:\Program Files (x86)\Common Files
CommonProgramFiles(x86)=D:\Program Files (x86)\Common Files
CommonProgramW6432=D:\Program Files\Common Files
COMPUTERNAME=RD0003FF80F0C8
ComSpec=D:\Windows\system32\cmd.exe
COREHOST_TRACE=1
deployment_branch=master
DEPLOYMENT_SOURCE=D:\home
DEPLOYMENT_TARGET=D:\home\site\wwwroot
DIRCMD=/OG /ON
EnableNuGetPackageRestore=true
FP_NO_HOST_CHECK=NO
GO_WEB_CONFIG_TEMPLATE=C:\Program Files (x86)\SiteExtensions\Kudu\53.50323.2151\bin\scripts\go.web.config.template
GYP_MSVS_VERSION=2015
HOME=D:\home
HOMEDRIVE=D:
HOMEPATH=\home
HOME_EXPANDED=C:\DWASFiles\Sites\#1trdai-dotnet-001\VirtualDirectory0
HTTP_HOST=trdai-dotnet-001.scm.azurewebsites.net
JAVA_HOME=D:\Program Files\Java\jdk1.7.0_51
KUDU_SELECT_NODE_VERSION_CMD=node "C:\Program Files (x86)\SiteExtensions\Kudu\53.50323.2151\bin\scripts\selectNodeVersion"
KUDU_SELECT_PYTHON_VERSION_CMD=python "C:\Program Files (x86)\SiteExtensions\Kudu\53.50323.2151\bin\scripts\select_python_version.py"
KUDU_SYNC_CMD=kudusync
LOCALAPPDATA=D:\local\LocalAppData
LOCAL_EXPANDED=C:\DWASFiles\Sites\#1trdai-dotnet-001
MSBUILD_PATH=D:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe
NPM_JS_PATH=D:\Program Files (x86)\npm\3.5.1\node_modules\npm\bin\npm-cli.js
NUGET_EXE=C:\Program Files (x86)\SiteExtensions\Kudu\53.50323.2151\bin\scripts\nuget.exe
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
Path=C:\Program Files (x86)\SiteExtensions\Kudu\53.50323.2151\bin\NativeBinaries/x86;C:\Program Files (x86)\SiteExtensions\Kudu\53.50323.2151\bin\scripts;D:\Program Files (x86)\MSBuild\14.0\Bin;D:\Program Files (x86)\Git\bin;D:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow;D:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn;D:\Program Files (x86)\Microsoft SDKs\F#\3.1\Framework\v4.0;D:\Program Files (x86)\npm\3.5.1;C:\DWASFiles\Sites\#1trdai-dotnet-001\AppData\npm;D:\Program Files (x86)\bower\1.3.12;D:\Program Files (x86)\grunt\0.1.13;D:\Program Files (x86)\gulp\3.9.0.1;D:\home\site\deployments\tools;D:\Program Files (x86)\nodejs\4.2.3;D:\Windows\system32;D:\Windows;D:\Windows\System32\Wbem;D:\Windows\System32\WindowsPowerShell\v1.0\;D:\Users\Administrator\AppData\Roaming\npm;D:\Program Files (x86)\nodejs\;d:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;D:\Program Files\Microsoft Network Monitor 3\;D:\Program Files (x86)\Mercurial\;D:\Program Files (x86)\PHP\v5.4;D:\Python27;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_ARCHITEW6432=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 63 Stepping 2, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=3f02
ProgramData=D:\local\ProgramData
ProgramFiles=D:\Program Files (x86)
ProgramFiles(x86)=D:\Program Files (x86)
ProgramW6432=D:\Program Files
PROMPT=$P$G
PSModulePath=D:\Windows\system32\WindowsPowerShell\v1.0\Modules\;d:\Program Files\Microsoft Security Client\MpProvider\;D:\Program Files\Microsoft Message Analyzer\PowerShell\
PUBLIC=D:\Users\Public
REGION_NAME=South Central US
REMOTEDEBUGGINGBITVERSION=vx86
REMOTEDEBUGGINGPORT=
REWRITETABLE=
ScmType=LocalGit
SCM_BUILD_ARGS=
SCM_COMMAND_IDLE_TIMEOUT=60
SCM_DNVM_PS_PATH=C:\Program Files (x86)\SiteExtensions\Kudu\53.50323.2151\bin\scripts\dnvm.ps1
SCM_GIT_EMAIL=windowsazure
SCM_GIT_USERNAME=windowsazure
SCM_LOGSTREAM_TIMEOUT=1800
SCM_TRACE_LEVEL=1
SELECT_LATEST_VERSION_CMD=C:\Program Files (x86)\SiteExtensions\Kudu\53.50323.2151\bin\scripts\selectLatestVersion.ps1
SITE_BITNESS=x86
SystemDrive=D:
SystemRoot=D:\Windows
TEMP=D:\local\Temp
TMP=D:\local\Temp
USERDOMAIN=WORKGROUP
USERNAME=RD0003FF80F0C8$
USERPROFILE=D:\local\UserProfile
VCInstallDir_140=D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\
VCTargetsPath=D:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\
WEBJOBS_DEPLOY_CMD=deploy_webjobs.cmd
webpages:Enabled=true
webpages:Version=3.0.0.0
WEBROOT_PATH=D:\home\site\wwwroot
WEBSITE_AUTH_ENABLED=False
WEBSITE_COMPUTE_MODE=Dedicated
WEBSITE_HOSTNAME=trdai-dotnet-001.azurewebsites.net
WEBSITE_HTTPLOGGING_ENABLED=0
WEBSITE_IIS_SITE_NAME=~1trdai-dotnet-001
WEBSITE_INSTANCE_ID=fadd7e2eb86d410651a344a3aa107a50e8049b18e0409ca5c14b8acb50613063
WEBSITE_LOCALCACHE_ENABLED=False
WEBSITE_NODE_DEFAULT_VERSION=4.2.3
WEBSITE_OWNER_NAME=6de210d0-cc8d-4f7e-ba0b-295f894b0638+trdai-test-01-SouthCentralUSwebspace
WEBSITE_SCM_ALWAYS_ON_ENABLED=0
WEBSITE_SCM_SEPARATE_STATUS=1
WEBSITE_SITE_NAME=trdai-dotnet-001
WEBSITE_SKU=Premium
WEBSITE_VOLUME_TYPE=PrimaryStorageVolume
WEBSOCKET_CONCURRENT_REQUEST_LIMIT=-1
windir=D:\Windows
windows_tracing_flags=
windows_tracing_logfile=
X-MS-SITE-RESTRICTED-JWT=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6ImloMF9oMU5aZzR4MTlBeWhzaExZU0YxcUxSSSJ9.eyJpc3MiOiJodHRwczovL2dlb21hc3Rlci5henVyZXdlYnNpdGVzLndpbmRvd3MubmV0LyIsImF1ZCI6Imh0dHBzOi8vdHJkYWktZG90bmV0LTAwMS5zY20uYXp1cmV3ZWJzaXRlcy5uZXQvIiwibmJmIjoxNDU4ODU3MDcxLCJleHAiOjE0NTg4NjA2NzEsInVuaXF1ZV9uYW1lIjoia3Rlc3QifQ.pyB6nZih321eGnvFK3_GkWp6xAMV79R609uqVYwz5vpV2lKLQ3QARVL-k5YjR2v6uzwnLZIVLV9jdLZv8tCw0OdmJuxpJ4SqALNqGMd5uj8xsHqxNvWqvXj7K9fhEZCHz3aP_RpJZrmEzKwy4wait1zy8qLnxXRLd5PQ2XIy-L3H6xje_2s73ecKWYuMz15FTm9_UR6-l686OU6Fgx5ZonGlYBXqiW7z8KoPC7NSDeSwdrnm0_81UrKE3mXOxQo1s_qgV5tDLcYr2Gd-4HZdd23hNyCSiRAchMlid_VtkvKcCpocuEVC0CnXs9thu5sRtX7iR79JG-NeBUkUBOZC5Q
/cc @davidfowl @pakrym @schellap
/cc @muratg this will block partners
@schellap, need your thoughts here
@troydai, can you try the latest CLI and see if it still reproes because I fixed a bug with path names with a dot in them. If it still reproes, I would like a remote VM or steps to repro locally on my box.
Tyring to repro. Taking a look...
@schellap the dotnet used here is 1.0.0-beta-1986, which is the latest (tried 30 seconds ago). I'm not able to repo this issue locally (Windows 10). This is a Azure Web Site on public cloud we only have limited access to the environment.
I just tried deploy.ps1 and was not able to repro it anymore, 1943 sounds old. This was during the hackathon days I believe and we have fixed several bugs since then.
@schellap it issue repos on 1986 build. It can't be repo locally as I tried on my own box.
Does it still not repro with corehost as you observed earlier, now that CLI is a portable app?
With latest build the issue is not fixed:
remote: Updating branch 'master'.
remote: Updating submodules.
remote: Preparing deployment for commit id '76b36941b9'.
remote: Running custom deployment command...
remote: Running deployment command...
remote:
remote: D:\home\site\repository>rem Deployment script for a CLI based rc2 ASP.NET MVC web applicaiton
remote: "In deploy.cmd"
remote: dotnet_install: Get-Azure-Channel-From-Channel -Channel "beta"
remote: dotnet_install: Get-CLIArchitecture-From-Architecture -Architecture "<auto>"
remote: dotnet_install: Get-Machine-Architecture
remote: dotnet_install: Get-CLIArchitecture-From-Architecture -Architecture "x86"
remote: dotnet_install: Get-Specific-Version-From-Version -AzureFeed "https://dotnetcli.blob.core.windows.net/dotnet" -AzureChannel "beta" -CLIArchitecture "x86" -Version "Latest"
remote: dotnet_install: Get-Latest-Version-Info -AzureFeed "https://dotnetcli.blob.core.windows.net/dotnet" -AzureChannel "beta" -CLIArchitecture "x86"
remote: dotnet_install: Get-Version-Info-From-Version-Text -VersionText "dc4bec03072cc1310b96f983227d965e9b3d5d7a
remote: 1.0.0-beta-002129
remote: "
remote: dotnet_install: Get-Download-Links -AzureFeed "https://dotnetcli.blob.core.windows.net/dotnet" -AzureChannel "beta" -SpecificVersion "1.0.0-beta-002129" -CLIArchitecture "x86"
remote: dotnet_install: Constructed payload URL: https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/1.0.0-beta-002129/dotnet-dev-win-x86.1.0.0-beta-002129.zip
remote: dotnet_install: Resolve-Installation-Path -InstallDir ".dotnet"
remote: dotnet_install: InstallRoot: .dotnet
remote: dotnet_install: Downloading https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/1.0.0-beta-002129/dotnet-dev-win-x86.1.0.0-beta-002129.zip
remote: dotnet_install: Extracting zip from https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/1.0.0-beta-002129/dotnet-dev-win-x86.1.0.0-beta-002129.zip
remote: dotnet_install: Extract-Dotnet-Package -ZipPath "D:\local\Temp\tmpB0B8.tmp" -OutPath ".dotnet"
remote: dotnet_install: Get-List-Of-Directories-And-Versions-To-Unpack-From-Dotnet-Package -Zip "System.IO.Compression.ZipArchive" -OutPath ".dotnet"
remote: dotnet_install: Directories to unpack: sdk/1.0.0-beta-002129/
remote: dotnet_install: Adding to current process PATH: "D:\home\site\repository\.dotnet\". Note: This change will not be visible if PowerShell was run as a child process.
remote: dotnet_install: Installation finished
remote: Failed to load the dll from D:\home\site\repository\.dotnet\shared\Microsoft.NETCore.App\1.0.0-rc2-23929\coreclr.dll, HRESULT: 0x8007007E
remote:
remote: Failed to bind to coreclr
remote:
remote: Could not load host policy library [D:]
remote:
remote: Could not load host policy library [D:]
remote:
remote: Could not load host policy library [D:]
remote:
remote:
remote: Error - Changes committed to remote repository but deployment to website failed.
dotnet --version?
build 002129, which contains your fix.
@troydai I need a better env to debug, rather than a console in the browser. It seems we are getting an UI dialog when this failure happens. It might contain some useful info.
Try the following and see if it solves the problem:
set PATH=%PATH%;c:\dotnet\shared\Microsoft.NETCore.App\1.0.0
Give this a shot, if this doesn't work, add sdk also to the path.
set PATH=%PATH%;c:\dotnet\sdk
@schellap re first workaround -- wouldn't it be a problem if two different apps use different versions of Microsoft.NETCore.App?
@troydai Perhaps @shhsu could help with his private stamp for a repro env.
@muratg, you could wrap in a setlocal in a cmd file?
What are the repro steps? When I try to deploy https://github.com/troydai/HelloMvcKudu to a clean Azure App, it fails for me as follows, which is completely different from what's reported here:
remote: Running deployment command...
remote:
remote: D:\home\site\repository>rem Deployment script for a CLI based rc2 ASP.NET MVC web applicaiton
remote: "In deploy.cmd"
remote: .
remote: ls : Cannot find path 'D:\home\site\repository\.dotnet\sdk\' because it does
remote: not exist.
remote: At D:\home\site\repository\deploy.ps1:9 char:16
remote: + $sdk_folder = (ls -Directory .dotnet\sdk\ | select -first 1).FullName
remote: + ~~~~~~~~~~~~~~~~~~~~~~~~~~
remote: + CategoryInfo : ObjectNotFound: (D:\home\site\repository\.dotnet
remote: \sdk\:String) [Get-ChildItem], ItemNotFoundException
remote: + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetCh
remote: ildItemCommand
The issue won't be repo on latest commit because fixes were made to work around this issue. Try push this status: https://github.com/troydai/HelloMvcKudu/tree/5e4473fb2f2b014c8c54f9ea65ad1810cc1c703a
Here is what I see after deployment when manually running dotnet.exe. Due to some display bug it's not correctly outputting stderr, so I redirect it to a file:
D:\home\site\repository\.dotnet>dotnet.exe 2> out.txt
Then I see the file contains:
Usage: dotnet [--help | app.dll]
Isn't that the expected behavior when running it without parameters?
As an aside, the reason the display is messed up appears to be that it's outputting bad line endings. Specifically it seems to have this sequence at the end 0x0d 0x0d 0x0a (probably should be 0x0d 0x0a 0x0d 0x0a).
@davidebbo can you run dotnet --info? The problem happens when parameter is feed because this is when it needs to locate a specific version of SDK.