Allow maximum published package size to be configured when using IIS#473
Allow maximum published package size to be configured when using IIS#473loic-sharma merged 3 commits intoloic-sharma:masterfrom ApewareLtd:master
Conversation
… to be set - defaulting to 250MB
| this IServiceCollection services, | ||
| IConfiguration configuration) | ||
| { | ||
| services.ConfigureAndValidate<IISServerOptions>(configuration.GetSection(nameof(IISServerOptions))); |
There was a problem hiding this comment.
I'd like to keep the appsettings.json file as light as possible. What do you think of setting the default of 250MB here? I think this should work:
// IIS defaults upload sizes to ~30MB. Increase it to 250MB.
// See https://github.com/aspnet/Announcements/issues/267
services.Configure<IISServerOptions>(iis=>
{
iis.MaxRequestBodySize = 262144000
});
services.ConfigureAndValidate<IISServerOptions>(configuration.GetSection(nameof(IISServerOptions)));I believe this should default to 250MB, yet let customers override that value by adding a IISServerOptions option.
src/BaGet/appsettings.json
Outdated
|
|
||
| "IISServerOptions": { | ||
| "MaxRequestBodySize": 262144000 | ||
| }, |
There was a problem hiding this comment.
If you go with my comment above https://github.com/loic-sharma/BaGet/pull/473/files#r378645236, please remove these lines since they are no longer necessary for the 250MB default.
|
Thank you for figuring this problem out. I'm a bit of an IIS noob so I really appreciate the help! :) Please let me know what you think of this comment #473 (comment), and I'll merge this fix in! |
|
Yep, I agree, I wasn't entirely comfortable with always having config for IIS in the appsettings even when you are not using IIS. Your solution is better and I'll update it when I get the chance later, although I was going to wait and see if there was more information on this comment #463 (comment), in case we don't need to do anything at all. |
…MB in code and remove defaults from appsettings.json
|
Is this MaxRequestBodySize not enough ? |
No, this setting doesn't seem to have any effect when hosting in IIS. @loic-sharma, I've updated the PR as suggested to set a default in code and remove the appsettings.json default section. I've updated the documentation to make reference to the IISServerOptions section in the Microsoft docs. |
|
Thanks for the contribution! :) |
Now sets the MaxRequestBodySize for IIS on startup.
Addresses #463