0

I have a website in ASP .NET Core Mvc 2.0 published in Azure. It worked fine until today when I updated the website. The update consist in changing the keys and passwords because the website have social logins providers. After updates and executing the website it gives me Http 500 error in browser.

Startup file

public class Startup
{
    private IConfiguration Configuration { get; set; }

    public Startup(IConfiguration configuration)
    {
        Configuration = configuration;    
    }
    // This method gets called by the runtime. Use this method to add services to the container.
    // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
    public void ConfigureServices(IServiceCollection services)
    {

        services.AddMvc(options =>
        {
            options.Filters.Add(new RequireHttpsAttribute());
        });
        var users = new Dictionary<string, string> { { "Admin", "Admin@1234" } };
        services.AddSingleton<IUserService>(new UserService(users));

        services.AddAuthentication(options =>
        {
            options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
            options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
            options.DefaultChallengeScheme = CookieAuthenticationDefaults.AuthenticationScheme;
        })
            .AddFacebook(facebookOptions =>
            {
                facebookOptions.AppId = Configuration["Authentication:Facebook:AppId"];
                facebookOptions.AppSecret = Configuration["Authentication:Facebook:AppSecret"];
            })
            .AddTwitter(options =>
            {
                options.ConsumerKey = Configuration["Authentication:Twitter:ConsumerKey"];
                options.ConsumerSecret = Configuration["Authentication:Twitter:ConsumerSecret"];
            })
            .AddMicrosoftAccount(options =>
            {
                options.ClientId = Configuration["Authentication:Microsoft:ApplicationId"];
                options.ClientSecret = Configuration["Authentication:Microsoft:Password"];
            })
            .AddGoogle(options =>
            {
                options.ClientId = Configuration["Authentication:Google:ClientId"];
                options.ClientSecret = Configuration["Authentication:Google:ClientSecret"];
            })
        .AddCookie(options =>
        {
            options.LoginPath = "/auth/signin";
        });
    }

    // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }

        app.UseRewriter(new Microsoft.AspNetCore.Rewrite.RewriteOptions().AddRedirectToHttps(301, 44301));
        app.UseStaticFiles();
        app.UseAuthentication();
        app.UseMvc();

    }
}

launchSettings.json file

 {
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "https://localhost:44301/",
      "sslPort": 44301
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Production"
      }
    },
    "IdentityApp": {
      "commandName": "Project",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "applicationUrl": "http://localhost:44301/"
    }
  }
}

I'm not sure what is going on but I suspect that is a https problem. There is no error in the code and after debugging the code there is no error.

I'm stuck someone can help please.

Thanks in advance.

Llazar
  • 3,167
  • 3
  • 17
  • 24
  • Usually, this is because of an Execption. Please activate you IDE to break on the all exceptions (many developers do not have this enabled by default). https://stackoverflow.com/a/116934/1987258 The base exception of that exception usually describes the real problem to solve. – Daan Dec 13 '18 at 20:45
  • I enabled the all exceptions breaks and nothing change @Daan. – Llazar Dec 14 '18 at 16:27

0 Answers0