Cannot find view but only when published to AWS Elastic Beanstalk

Benjamin Sims 21 Reputation points
2022-08-09T17:03:38.83+00:00

I have an ASP.NET 6 project that's working just fine when I have it running on my local machine, but when I publish up to AWS Elastic Beanstalk, it can't find any views. I've tried explicitly adding the views to the build, added MvcRazorCompileOnPublish to the csproj file, and tried setting the build to explicitly use x64, and none of these have fixed the issue. Is there any other steps I may have missed to make this publish properly?

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,208 questions
0 comments No comments
{count} votes

6 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 56,931 Reputation points
    2022-08-09T17:49:11.02+00:00

    what do you mean? what is the error? have you run the published folder directly on your local box? what AWS environment did you deploy to, windows, linux or docker? what is in the zip file you deployed? what is the folder structure on the AWS deployment?

    note: the default publish does not include any razor page files.


  2. Takahito Iwasa 4,841 Reputation points MVP
    2022-08-09T22:02:50.507+00:00

    Hi, @Benjamin Sims

    I created a new ASP.NET Core MVC application with .NET 6 in Visual Studio and used the AWS Toolkit for Visual Studio to "Deploy to ElasticBeanstalk (Legacy)".

    It was successfully issued as below.

    229639-image.png

    So it's probably your project's problem, not ElasticBeanstalk's problem.
    Does the same problem occur when you create a new project?
    If it doesn't happen, you have to compare the minimal project that succeeds with your project that fails.

    0 comments No comments

  3. Bruce (SqlWork.com) 56,931 Reputation points
    2022-08-10T15:39:27.217+00:00

    what version of asp.net core are you using? did you use default authentication or create your own authentication forms? what type of AWS deploy are you doing (source, or binary)?

    you should do a folder publish locally and test. then compare this folder structure to the AWS deployed structure.

    note: the default authentication uses razor pages built into the dll.

    0 comments No comments

  4. Benjamin Sims 21 Reputation points
    2022-08-10T20:03:07.367+00:00

    @Bruce (SqlWork.com)
    Currently using .NET 6, upgraded from .NET Framework 4.7.2. I'm not sure if the default authentication was used or not, but I assume it was. I'm unsure as to if the deploy is source or binary, as I just use the AWS Toolkit for VS to deploy.

    The files in the publish folder look to be the same as the files being sent to AWS.


  5. Bruce (SqlWork.com) 56,931 Reputation points
    2022-08-10T22:47:54.823+00:00

    there was a bug in the razor compiler before sdk 6.0.300. be sure you have the latest updates.

    show us:

    dotnet --list-sdks

    and the vs 2022 version you are using.