ASP.NET Core site - internal server error

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

Tags:
  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:
    Code:
    <PropertyGroup>
        <WebPublishMethod>FTP</WebPublishMethod>
        <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
        <LastUsedPlatform>Any CPU</LastUsedPlatform>
        <SiteUrlToLaunchAfterPublish>http://ccybers.com/bookinfo</SiteUrlToLaunchAfterPublish>
        <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
        <ExcludeApp_Data>False</ExcludeApp_Data>
        <TargetFramework>netcoreapp2.1.2</TargetFramework>
        <ProjectGuid>2400130c-5c7f-40f2-95cf-0e3327423104</ProjectGuid>
        <SelfContained>false</SelfContained>
        <_IsPortable>true</_IsPortable>
        <publishUrl>ftp.ccybers.com</publishUrl>
        <DeleteExistingFiles>False</DeleteExistingFiles>
        <FtpPassiveMode>True</FtpPassiveMode>
        <FtpSitePath>bookinfo</FtpSitePath>
        <UserName>ccybersc</UserName>
        <_SavePWD>True</_SavePWD>
      </PropertyGroup>
    Here is my web.config file:
    Code:
    <configuration>
      <location path="." inheritInChildApplications="false">
        <system.webServer>
          <handlers>
            <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
          </handlers>
          <aspNetCore processPath="dotnet" arguments=".\BookInfo.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
        </system.webServer>
      </location>
    </configuration>
     
  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