Posts

Showing posts from May, 2023

Solved : 'WebApplication' does not contain a definition for 'UseKestrel' and the best extension method overload 'WebHostBuilder Kestrel Extensions.UseKestrel(IWebHostBuilder, Action)' requires a receiver of type 'IWebHostBuilder'

I had a requirement to upload files to .NET Core controller using Ajax call. Everything works well when the file size is < 30 Mb. When we try to upload larger files, the controller doesn't receive any files in the POST. Its always null. IList < IFormFile > files var file = Request.Form.Files[ 0 ]; All the values were null, I tried using Files as parameter to the post and also tried using " Request.Form ". After some research, I found that the upload limit of the Kestrel server need to be increased as it limits it by default set to 30 or 50 Mb(not very sure). When trying to add Kestrel  to the builder configuration, I was getting following error: "' WebApplication' does not contain a definition for 'UseKestrel' and the best extension method overload 'WebHostBuilder Kestrel Extensions.UseKestrel(IWebHostBuilder, Action<KestrelServerOptions>)' requires a receiver of type 'IWebHostBuilder '" SOLUTION: My .Net SDK vers