Error after deploying asp.net core app to azure

后端 未结 3 1323
猫巷女王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条回答
  •  闹比i
    闹比i (楼主)
    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();
        ...
    }
    

提交回复
热议问题