Error after deploying asp.net core app to azure

后端 未结 3 1321
猫巷女王i
猫巷女王i 2021-02-04 07:35

After deploying my asp.net core app to azure for the first time and ran it, I got the following error:

Error. An error occurred while processing your requ

相关标签:
3条回答
  • 2021-02-04 08:20

    thanks for your comments. I was able to find error details by adding the following key in application settings in azure portal: ASPNETCORE_ENVIRONMENT with value: Development

    I have created a new question regarding the error itself: InvalidOperationException: Could not find 'UserSecretsIdAttribute' on assembly

    Thank you

    0 讨论(0)
  • 2021-02-04 08:20

    It is a security measure used in production mode so that any user does not got sensitive exception information from our app.

    You can change ASPNETCORE_ENVIRONMENT from "Production" to "Development".

    Another option is to change the code for the Configure () method in Startup.cs. It is this method makes a validation:

    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }
        else
        {
            app.UseExceptionHandler("/Error");
        }
    
        ...
    }
    

    It is not recommended, but you can eliminate this condition:

    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        app.UseDeveloperExceptionPage();
        ...
    }
    
    0 讨论(0)
  • 2021-02-04 08:21

    Just so it's clear - still something that comes up in ASP.NET Core 2.0 - and as @Techy stated - is in Azure. Go to Azure, click on your Web App –> "Applications Settings" –> go down to the “App Settings” section and add the “ASPNETCORE_ENVIRONMENT” and “Development”

    0 讨论(0)
提交回复
热议问题