Failed to load the dll from [Project_Path\bin\Release\netcoreapp2.2\publish\coreclr.dll], HRESULT: 0x8007045A

0

I have a dotnet core 2.2 console app.
I hosted it as windows service.(Service name: "MyService1")
"MyService1" starts up child proccess("MyWebAPIApp.exe") as different user ("MyWebAPIApp": is another dotnet core application).

I published "MyWebAPIApp" with the following Settings:
Target Framework: netcoreapp2.2
Deployment mode: self-contained.
Target Runtime: win-x64

Code to start process:

string exePath ="Project_Path\bin\Release\netcoreapp2.2\publish\MyWebAPIApp.exe"

private Process StartProcess(string exePath)
{
    bool IsServiceStarted = false;
    Process process = null;

    if (string.IsNullOrWhiteSpace(exePath) == false)
    {
        SecureString password = new SecureString();
        password.AppendChar('1');

        process = new Process
        {
            StartInfo = new ProcessStartInfo(DefDotNet)
            {
                UseShellExecute = false,
                CreateNoWindow = true,
                FileName = exePath,
                WorkingDirectory = Path.GetDirectoryName(exePath),
                Domain = ".",
                UserName = "Test",  //※ this user dont have any administrative privileges 
                Password = password,
                RedirectStandardError = true,
                RedirectStandardInput = true,
                RedirectStandardOutput = true
            },
            EnableRaisingEvents = true
        };

        // Exit Event
        process.Exited += OnProcessExit;

        // Start service
        try
        {
            IsServiceStarted = process.Start();
        }
        catch (Exception ex)
        {
            // Handle exception
        }

        if (IsServiceStarted == false)
        {
            process = null;
        }
    }
    return process;
}  

Above code giving below error message:
failed to load the dll from [Project_Path\bin\Release\netcoreapp2.2\publish\coreclr.dll], HRESULT: 0x8007045A
Failed to bind to CoreCLR at 'Project_Path\bin\Release\netcoreapp2.2\publish\coreclr.dll'

Project path has "coreclr.dll" but I don't know why it is not binding.

Note: If I start process without Domain, UserName & Password it works properly.

asp.net-core
windows-services
asp.net-core-2.2
asked on Stack Overflow Sep 11, 2019 by RPrashant

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0