aspNetCore processPath doesn't point to correct directory for dotnet.exe

Each time I deploy an application, the web.config file in the application folder on the server (e.g. inetpub/wwwroot/myapplication) gets overwritten.

The default processPath gets set to "dotnet", e.g:

aspNetCore processPath="dotnet" arguments=".\server.dll" stdoutLogEnabled="true" stdoutLogFile=".\radzen" forwardWindowsAuthToken="false" /

I have to go in and manually amend this to the explicit path to dotnet.exe

aspNetCore processPath="C:\Program Files\dotnet\dotnet.exe" arguments=".\server.dll" stdoutLogEnabled="true" stdoutLogFile=".\radzen" forwardWindowsAuthToken="false" /

I have to do this each time I deploy! Should the application be able to find dotnet.exe by itself? Or can we have a place in the Radzen project where we can store a variable with the explicit path to dotnet.exe, to save having to remote onto the server and change this every time?

Why not add dotnet to Path environment variable? In this way you will not have to use explicit path:

  1. Open control panel>System and Security>System
  2. Click on Advanced system settings
  3. In advanced section, click in Environment Variables
  4. In System variables, select path and edit
  5. After semicolon, write "C:\Program Files\dotnet"
  6. Click on Ok button till end.

Thanks for the suggestion.

I looked in Path and dotnet is already there:

image

The directory for the x86 version was also in Path so my colleague wondered if Radzen was finding that first and failing to fire up the correct version. So I removed the x86 version from Path and it still doesn't work. Also tried removing the trailing \ after dotnet.

Other possible solution is to put the web.config in Radzen ignore list in application settings. In this case Radzen will not overwrite your change.

It is IIS that cannot find dotnet and not Radzen in this case - when you deploy the application it is run by IIS. What you describe seems to be this issue. The web.config file that Radzen generates contains the following:

<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="true" stdoutLogFile=".\radzen" forwardWindowsAuthToken="false"/>

According to the aforementioned issue LAUNCHER_PATH gets replaced by WebDeploy with dotnet.

The issue mention three solutions:

  • Restarting the server if it hasn't been restated after installing .NET Core
  • Moving the 64 bit path before the 32 bit.
    In order to prevent Radzen from overwriting the file AND WebDeploy from replacing it you can do the following:
  • And finally updating the web.config and appending
<PropertyGroup>
  <IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
</PropertyGroup>

If you decide to try the last solution you need to add web.config to Radzen's code generation ignore list as @enchev suggested.