ASP.NET Core site - internal server error

Discussion in 'General troubleshooting' started by Brian Bird, Feb 2, 2019.

  1. I published an ASP.NET Core 2.1.2 site using the framework dependent method. When I view the site I see this web page:

    An error occurred while starting the application.
    .NET Core 4.6.27019.06 X64 v4.0.0.0 | Microsoft.AspNetCore.Hosting version 2.0.0-rtm-26452 | Microsoft Windows 6.3.9600 | Need help?

    Can someone help me or give me some tips on how to get this to work?
    More details follow:

    In my .csproj file, I set the target framework to 2.1.2

    Here are my Publish profile settings:
        <LastUsedPlatform>Any CPU</LastUsedPlatform>
    Here is my web.config file:
      <location path="." inheritInChildApplications="false">
            <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
          <aspNetCore processPath="dotnet" arguments=".\BookInfo.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
  2. Update: I set stdoutLogEnabled="true" and then recycled the application pool. A log file was generated and from the log I can see that the app is trying to use the connection string for my local database instead of the one I entered in the Publish Profile. How do I get the app to use the one in the Publish Profile? Is it an issue that I published using FTP instead of WebDeploy?
  3. ComputerMan

    ComputerMan Winhost Staff

    Use web deploy and I believe you need to set the connection string with the Release setting instead of the debug setting.
    Brian Bird likes this.
  4. Yes, that was the problem. I thought that by entering the production connection string into the Publish settings dialog, it would be used on the server, but I needed to add second appsettings file, appsettings.production.json, containing the connection string for the database on Winhost.
    ComputerMan likes this.

Share This Page