I have a project written using C# on the top of Asp.NET Core 2.2 framework.
I was able to publish it to my VPS. But, when I try to access the website I get the following error
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Here is the content of the web.config file located in the root
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\ProjectName.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />
    </system.webServer>
  </location>
</configuration>
<!--ProjectGuid: 47b26df0-8a01-4d75-9549-3a98654550a3-->
The web.config file was published via Visual Studio along with the rest of my files. But I don't see web.config file in my solution.
This file seems to be invalid. How can I fix the web.config file?
If I remove the web.config file and add index.html page the site work. It sounds to me that web.config the file is invalid for some reason.
Updated I am able to run the application using the command line. using the command line, I did the following
cd C:\inetpub\wwwroot\ProjectName)dotnet ProjectName.dllBut when I access it using the domain name, I still get Http Error 500.19 as stated above.
As discussed in comments
Install AspnetCore module in iis
Setup ASPNETCORE_ENVIRONMENT to production in your environment or setup in web.config.
<aspNetCore processPath="dotnet"
      arguments=".\MyApp.dll"
      stdoutLogEnabled="false"
      stdoutLogFile="\\?\%home%\LogFiles\stdout"
      hostingModel="InProcess">
  <environmentVariables>
    <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" />
  </environmentVariables>
</aspNetCore>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With