skip to Main Content

I created a Asp.Net Core app with Visual Studio and used the publish option of VS to publish my app on my Azure account.

After publishing it, I used the link to access my website but I get a "HTTP Error 500.30 – ASP.NET Core app failed to start"

I went to the console in Azure to manually start my app and have more detail about the issue and I got this. error on console

Not really sure how to solve this issue with my port

Below is the code from program.cs

var connectionString = builder.Configuration.GetConnectionString("LocalConnection");
builder.Services.AddDbContext<LotharDataBaseContext>(options =>
    options.UseSqlServer(connectionString));

builder.Services.AddControllersWithViews();

builder.Services.AddAuthentication(NegotiateDefaults.AuthenticationScheme)
   .AddNegotiate();

builder.Services.AddAuthorization(options =>
{
    // By default, all incoming requests will be authorized according to the default policy.
    options.FallbackPolicy = options.DefaultPolicy;
});
builder.Services.AddRazorPages();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
    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.UseRouting();

app.UseAuthentication();
app.UseAuthorization();

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

app.Run();

2

Answers


  1. Through your screenshot, I saw Kestrel, so I think, the webapp you created should be on linux platform. The port occupancy on your screenshot is expected behavior, it shouldn’t be the root cause. Since the site is already running, and you manually command it to start again, this error should appear.

    I suggest you provide your Program.cs file first, we need to look at UseUrls, or the code for UseKestrel.

    How to check the logs when start webapp:

    1. open you kudu site, url should be https://your_app_name.scm.azurewebsites.net

    2. open newui, https://your_app_name.scm.azurewebsites.net/newui

    3. steps:

    enter image description here

    enter image description here

    enter image description here

    1. In this default_docker.log file, we will get useful message.

    Steps you can try:

    1. Try to add .UseIIS, and we know your platform is linux.

      Kestrel address binding errors in azure app service

    2. Remove .UseUrls(), and re-deploy your webapp.

    Login or Signup to reply.
  2. In my case, i was using the azure sql database so changing the connection string of database to use tcp protocol and 1433 as port, resolved this problem.
    e-g

    Server=tcp:<ServerName>.database.windows.net,1433;Initial Catalog=<DatabaseName>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search