.Net Core Resim Yükleme Hatası

.net core 3.1 ‘de resim yüklerken aşağıdaki bir hata aldım.

Error.
An error occurred while processing your request.
Request ID: |dafa2808-45b4fe0e53de7377.

Development Mode
Swapping to Development environment will display more detailed information about the error that occurred.

The Development environment shouldnt be enabled for deployed applications. It can result in displaying sensitive information from exceptions to end users. For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development and restarting the app.

Bu hatanın çözümü için biraz uğraştım. Yoğunlaşmam genel olarak izinden dosya yolunun izninden kaynaklanacağı yönünde idi. Hatayı yanlış tespit etmemden kaynaklı olacak ki çözümü yetkilendirmede bulamadım.

loglara baktığım zaman şu şekilde

Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs-version cs(User-Agent) cs(Referer) cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken 2021-02-10 00:18:10 94.73.149.62 GET /img/home1/insta-4.jpg – 80 – 207.46.13.49 HTTP/1.1 Mozilla/5.0+(compatible;+bingbot/2.0;++http://www.bing.com/bingbot.htm) – yalincode.com 200 0 0 1014 304 1781 Software: Microsoft Internet Information Services 8.5

Bu sorunun çözümü için Program.cs class’ında aşağıdaki güzenlemeyi yaptım.

    public static IHostBuilder CreateHostBuilder(string [] args) =>
    Host.CreateDefaultBuilder(args)
        .ConfigureWebHostDefaults(webBuilder =>
        {
            webBuilder.ConfigureKestrel(kestrelOptions =>
            {
                kestrelOptions.ConfigureHttpsDefaults(configureOptions: httpsOptions =>
                {
                    httpsOptions.SslProtocols = SslProtocols.Tls12;
                });
            });

            webBuilder.UseStartup<Startup>(); 
        });

tekrardan build alıp publish aldıktan sonra sorun çözüldü

Bir cevap yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir