Çağdaş KARADEMİR
  • Blog Roadmap
  • 2020
    • EntityFramework Query Tagging
    • [HOTFIX] Npm Self Sertifika Hatasının Çözümü
    • Level101 — Ubuntu Sunucuya Docker Community Edition Kurulumu Nasıl Yapılır?
    • Level101 — Amazon Üzerinde Ubuntu Sunucu Nasıl Açılır?
    • [Lvl101] - Azure Üzerinde PostgreSql Kurulumu
  • 2019
    • [HOTFIX] Datagrip AutoComplete Not Working
    • Kubernetes Dashboard UI Kurulumu Nasıl Yapılır?
    • [HOTFIX] Git Self Sertifika Hatasının Çözümü
    • Node.js Son Versiyona Nasıl Yükseltebilirim?
    • MacOs Üzerine Docker Sql Server Nasıl Kurulur?
    • Asp.Net Core Api İle Graphql Projesi Oluşturmak
    • Reset Identity Seed After Deleting Records in SQL Server
    • Synchronous operations are disallowed.
    • Bootbox.js Nedir, Nasıl Kullanılır?
    • Less Secure Apps — Gmail Smtp Üzerinden Mail Gönderme Hatası
Powered by GitBook
On this page

Was this helpful?

  1. 2019

Synchronous operations are disallowed.

Asp.net Core 3.0 üzerinde AllowSynchronousIO değeri False ise aşağıdaki gibi bir hata fırlatacaktır.

Eğer aşağıdaki gibi "Synchronous operations are disallowed. Call ReadAsync or set AllowSynchronousIO to true instead." mesajını alırsanız;

System.InvalidOperationException: Synchronous operations are disallowed. Call ReadAsync or set AllowSynchronousIO to true instead.
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpRequestStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.StreamReader.ReadBuffer(Span`1 userBuffer, Boolean& readToUserBuffer)
   at System.IO.StreamReader.ReadSpan(Span`1 buffer)
   at System.IO.StreamReader.Read(Char[] buffer, Int32 index, Int32 count)
   at Newtonsoft.Json.JsonTextReader.ReadData(Boolean append, Int32 charsRequired)
   at Newtonsoft.Json.JsonTextReader.ReadData(Boolean append)
   at Newtonsoft.Json.JsonTextReader.ParseValue()
   at Newtonsoft.Json.JsonTextReader.Read()
   at Newtonsoft.Json.JsonReader.ReadAndMoveToContent()
   at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)
   at GraphQL.Server.Transports.AspNetCore.GraphQLHttpMiddleware`1.Deserialize[T](Stream s)
   at GraphQL.Server.Transports.AspNetCore.GraphQLHttpMiddleware`1.InvokeAsync(HttpContext context)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)

Program.cs dosyası içerisinde

 .ConfigureKestrel((context, options) =>
                        {
                            options.AllowSynchronousIO = true;
                        });

satırını eklemeniz yeterli olacaktır.

.net core 3.0 - program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace CK.Tutorial.GraphQlApi.Web
{
    public class Program
    {
        public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.UseStartup<Startup>()
         
               .ConfigureKestrel((context, options) =>
                        {
                            options.AllowSynchronousIO = true;
                        });
                });
    }
}
PreviousReset Identity Seed After Deleting Records in SQL ServerNextBootbox.js Nedir, Nasıl Kullanılır?

Last updated 5 years ago

Was this helpful?

Reference :

https://github.com/aspnet/AspNetCore/issues/7644