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.
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 version is 7.0.100
In your program.cs, add the following code
The above code shall already be there.
Add the following with the desired limit, I have used 100Mb.
Keep Coding.....
Comments