Skip to content
This repository was archived by the owner on Dec 18, 2017. It is now read-only.
This repository was archived by the owner on Dec 18, 2017. It is now read-only.

DNX Web publishing doesn't register package runtime #3316

@kkurni

Description

@kkurni

When you publish your web project, you will get AppRoot/web.cmd
This AppRoot/web.cmd will get executed on IIS and fire DNX.exe.When publishing web project, it will create AppRoot/web.cmd
IIS will execute this Web.cmd and it will execute DNX.exe.

Unfortunately this web.cmd doesn't register your runtime (which should be on your current publish package). So it will use any runtime that you installed in your user profile.

In IIS, by default it will run your web application with "ApplicationPoolIndentiy" user, But your DNX runtime was installed under your local user. This is the root cause why you get sni.dll loader exception. Because it is depend on api-ms-win-core-stringansi-l1-1-0.dll which should be located inside your runtime.

In other cases, this will lead to the different runtime version.
E.g you published x64 version, but you set your current dnvm environment with x86.
When you run this using approot/web.cmd, this will use x86 runtime which will cause exception to load native dll

For workaround, you can modify web.cmd to add your runtime into your path.
SET "PATH=%PATH%;%~dp0runtimes%DNX_FOLDER%\bin;"

I heard that dnx will be replaced by CLI.
but i thought this will be a good fix to take while waiting for that CLI.

Here is the issue in corefx : https://github.com/dotnet/corefx/issues/5252

@echo off
SET DNX_FOLDER={runtimeFolder}
SET ""LOCAL_DNX=%~dp0runtimes\%DNX_FOLDER%\bin\{Runtime.Constants.BootstrapperExeName}.exe""
IF EXIST %LOCAL_DNX% (
SET ""DNX_PATH=%LOCAL_DNX%""
)
for %%a in (%DNX_HOME%) do (
IF EXIST %%a\runtimes\%DNX_FOLDER%\bin\{Runtime.Constants.BootstrapperExeName}.exe (
SET ""HOME_DNX=%%a\runtimes\%DNX_FOLDER%\bin\{Runtime.Constants.BootstrapperExeName}.exe""
goto :continue
)
)
:continue
IF ""%HOME_DNX%"" NEQ """" (
SET ""DNX_PATH=%HOME_DNX%""
)
IF ""%DNX_PATH%"" == """" (
SET ""DNX_PATH={Runtime.Constants.BootstrapperExeName}.exe""
)
@""%DNX_PATH%"" --project ""%~dp0{relativeAppBase}"" --configuration {Configuration} {commandName} %*

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions