Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

555
Views
ASP.NET Core MVC App on Linux - Raspberry Pi Not displaying correctly

I got an ASP .Net MVC WebApp running on raspberry Pi, with NGINX Server. It's a blank project, the default MVC project.

I got it deployed and accessible via the network. However, it does not display correctly either on the Pi or accessing via from my Laptop.

It does display correctly when I run it from the Debug in my VS. Running on Debug from VS: SP Same app running "Dotnet App.dll" from Linux: enter image description here I was wondering if I am missing something on the Program.cs or Startup.cs, or if I am publishing it wrong.

Publish Options: File / Release / netcore3.1 / Framework-Dependent / Portable (Tried Linux-arm - same)

Program.cs:

public class Program
{
    public static void Main(string[] args)
    {
        CreateHostBuilder(args).Build().Run();
    }

    public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
            .ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder.UseUrls("http://localhost:5000");
                webBuilder.UseStartup<Startup>();
            });
}

Startup.cs

 public class Startup
{
    public Startup(IConfiguration configuration)
    {
        Configuration = configuration;
    }

    public IConfiguration Configuration { get; }

    // This method gets called by the runtime. Use this method to add services to the container.
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddControllersWithViews();
        services.Configure<ForwardedHeadersOptions>(options =>
        {
            options.KnownProxies.Add(IPAddress.Parse("192.168.1.1"));
        });
    }

    // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }
        else
        {
            app.UseExceptionHandler("/Home/Error");
            // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
            app.UseHsts();
        }
        //app.UseHttpsRedirection();
        app.UseStaticFiles();
        app.UseCookiePolicy();
        app.UseRouting();
        app.UseAuthorization();

        app.UseEndpoints(endpoints =>
        {
            endpoints.MapControllerRoute(
                name: "default",
                pattern: "{controller=Home}/{action=Index}/{id?}");
        });
    }
}

App Install Folder in the Linux: enter image description here

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

As per the comments, NGINX Files were pointing to the wrong directory. The problem was the configuration of "sites-enabled" location, not pointing to where the HTML lives.

More info see the NGINX Docs or the LINK: Tutorial ASP.NET CORE - PI

Solved!

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!