Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

افزایش زمان اجرای درخواست در آپلود فایل #49

Closed
sbrfarhadi opened this issue Jun 11, 2020 · 2 comments
Closed

Comments

@sbrfarhadi
Copy link

sbrfarhadi commented Jun 11, 2020

با سلام پروژه رو روی iis منتشر کردم برای آپلود فایل تنظیم زیر رو انجام دادم و محدودیت حجم آپلود رو نامحدود گذاشتم

public void ConfigureServices(IServiceCollection services)
        {
            services.Configure<IISServerOptions>(options =>
            {
                options.MaxRequestBodySize = null;
            });

            services.AddControllersWithViews();
        }

و توی وب کانفیگ تنظیم زیر رو گذاشتم

<security>
    <requestFiltering>
      <!-- This will handle requests up to 300MB -->
      <requestLimits maxAllowedContentLength="314572800" />
    </requestFiltering>
  </security>

و توی تگ aspNetCore تو فایل وب کانفیگ هم حالت هاستینگ رو inprocess تنظیم هستش چطوری requestTimeout رو باید بیشتر از 2 دقیقه کنم

کد فایل وب کنفیگ که توی asp.net mvc استفاده میشد هم اینجا عمل نمیکنه

توی تگ aspNetCore وب کانفیگ خصوصیت requestTimeout هست که اونم کار نکرد

.NET Core SDK version: 3.1
IDE: 
@VahidN
Copy link
Owner

VahidN commented Jun 11, 2020

اين تنظيمات را بررسي كنيد.

@VahidN VahidN closed this as completed Jun 11, 2020
@sbrfarhadi
Copy link
Author

sbrfarhadi commented Jun 11, 2020

بسیار ممنونم از شما، یک پروژه خالی از asp core ایجاد کردم و تنظیمات لینک ارسالی شما رو براش گذاشتم و توی IIS منتشر کردم

جالب برام اینه که فقط با کد زیر مشکل تایم اوت حل میشه و خصوصیت requestTimeout داخل تگ aspNetCore تاثیری نذاشت، درحالیکه این کد هیچ نشانی برای تایم اوت نداشت

services.Configure<FormOptions>(options =>
            {
                options.ValueLengthLimit = int.MaxValue;
                options.MultipartBodyLengthLimit = long.MaxValue; // <-- ! long.MaxValue
                options.MultipartBoundaryLengthLimit = int.MaxValue;
                options.MultipartHeadersCountLimit = int.MaxValue;
                options.MultipartHeadersLengthLimit = int.MaxValue;
            });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants