YAFLogo

tolox
  • tolox
  • 55.4% (Neutral)
  • YAF Forumling Topic Starter
10 years ago
When I try to upload attachments to an answer I only can upload small PDFs (0,6 MB works but 5MB doesn´t).

When I used Version 2.0.1 I got an error message (like "turn on custom errors to see the error"). Now I updated to 2.2.0 and not even get an error message anymore. It just doesn´t upload the file.

To be sure that it is not a problem of file size limitation i set the limit to "empty" to not have a limit. But it still doesn´t work.

Do you have an idea?

Sponsor
tolox
  • tolox
  • 55.4% (Neutral)
  • YAF Forumling Topic Starter
10 years ago
Zero2Cool
  • Zero2Cool
  • 100% (Exalted)
  • YAF Leader YAF Version: YAF 3.1.16
10 years ago
Are you able to upload the second file to this topic?
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
10 years ago

no idea?

Originally Posted by: tolox 

This is proberly caused by the default upload limit in a asp.net application, you can increase it in the web.config

<configuration>
  <system.web>
    <httpRuntime maxRequestLength="xxx" />
  </system.web>
</configuration>

"xxx" is in KB. The default is 4096 (= 4 MB)

tolox
  • tolox
  • 55.4% (Neutral)
  • YAF Forumling Topic Starter
10 years ago
There is no maxRequestLength in the web.config .

Here is the web.config . Probably you can find something wrong in it.

(I deleted the token keys)


<?xml version="1.0" encoding="utf-8"?>

<configuration>
    <configSections>
        <section name="rewriter"
                 type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter"
                 requirePermission="false" />
    </configSections>

    <connectionStrings configSource="db.config" />

    <appSettings configSource="app.config" />

    <rewriter configSource="URLRewriter.config" />

    <system.net>
        <mailSettings>
            <smtp configSource="mail.config" />
        </mailSettings>
    </system.net>

    <system.web>


        <httpRuntime requestValidationMode="2.0" />

        <xhtmlConformance mode="Strict" />

        <customErrors defaultRedirect="Error.aspx" mode="ON" />

        <!--  GLOBALIZATION
            This section sets the globalization settings of the application. 
            Utf-8 is not supported on Netscape 4.x 
            If you need netscape compatiblity leave iso-8859-1.
            UTF-8 is recommended for complex languages
        -->
        <globalization culture="en-US" uiCulture="en" requestEncoding="UTF-8" responseEncoding="UTF-8"
                       fileEncoding="UTF-8" />
        <!--<globalization culture="en-US" uiCulture="en"  fileEncoding="iso-8859-1" requestEncoding="iso-8859-1" responseEncoding="iso-8859-1"/>-->

        <authentication mode="Forms">
            <forms name=".YAFNET_Authentication" protection="All" timeout="43200" cookieless="UseCookies" />
        </authentication>

        <!-- COMPILATION
        * Set debug to "true" to test out the system in development 
        * Set optimizeCompilation to "true" for *MUCH* faster application pool
            restarts on larger .NET systems. But, please read and understand the caveats
            before enabling this settings:
            http://blogs.msdn.com/b/davidebb/archive/2009/04/15/a-new-flag-to-optimize-asp-net-compilation-behavior.aspx             
        -->
        <compilation debug="false" targetFramework="4.0" optimizeCompilations="false">
            <assemblies>
                <add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=" />
                <add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=" />
                <add assembly="System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=" />
                <add assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=" />
                <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=" />
                <add assembly="System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=" />
                <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=" />
                <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=" />
            </assemblies>
        </compilation>

        <httpHandlers>
            <add verb="GET" path="Resource.ashx" type="YAF.YafResourceHandler, YAF" />
        </httpHandlers>

        <httpModules>
            <add name="YafTaskModule" type="YAF.Core.YafTaskModule, YAF.Core" />
            <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter" />
        </httpModules>

        <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" enableEventValidation="false" validateRequest="false">
            <controls>
                <!-- Default: use non-dynamic (compiled classes) in YAF -->
                <add tagPrefix="YAF" namespace="YAF.Controls" assembly="YAF.Controls" />
                <add tagPrefix="YAF" namespace="YAF.Controls.Statistics" assembly="YAF.Controls" />
                <add tagPrefix="YAF" namespace="YAF.Classes" />
                <add tagPrefix="YAF" namespace="YAF" />
            </controls>
            <namespaces>
                <add namespace="YAF.Core" />
                <add namespace="YAF.Controls" />
                <add namespace="YAF.Utils" />
                <add namespace="YAF.Types.Interfaces" />
                <add namespace="YAF.Types" />
            </namespaces>
        </pages>

        <membership defaultProvider="YafMembershipProvider" hashAlgorithmType="SHA1">
            <providers>
                <clear />
                <!-- YAF's ASP.NET Membership Provider is designed to work a bit better with YAF.NET options, but is by no means required.
                    But, you will not be able to switch providers after installing your forum. -->
                <add name="YafMembershipProvider" applicationName="YetAnotherForum" connectionStringName="yafnet"
                     requiresUniqueEmail="true" useSalt="true" type="YAF.Providers.Membership.YafMembershipProvider" />
                
                <!-- Uncommend and set as default if you want to use use the built-in ASP.NET membership provider. Password Type of "Encrypted" requires a machine key. -->
                <!--<add name="AspNetSqlMembershipProvider" applicationName="YetAnotherForum" connectionStringName="yafnet"
                     enablePasswordReset="false" enablePasswordRetrieval="true" maxInvalidPasswordAttempts="5"
                     minRequiredNonalphanumericCharacters="0" minRequiredPasswordLength="5" passwordAttemptWindow="15"
                     passwordFormat="Encrypted" requiresQuestionAndAnswer="false" requiresUniqueEmail="true"
                     type="System.Web.Security.SqlMembershipProvider" />-->
            </providers>
        </membership>

        <roleManager enabled="true" defaultProvider="YafRoleProvider">
            <providers>
                <clear />
                <!-- YAF's ASP.NET Role Provider is designed to work a bit better with YAF.NET options, but is by no means required.
                     But, you will not be able to switch providers after installing your forum. -->
                <add name="YafRoleProvider" applicationName="YetAnotherForum" connectionStringName="yafnet"
                     type="YAF.Providers.Roles.YafRoleProvider" />
                <!-- Uncomment and set as default if you want to use use the built-in ASP.NET role provider. -->
                <!--<add name="AspNetSqlRoleProvider" applicationName="YetAnotherForum" connectionStringName="yafnet"
                     type="System.Web.Security.SqlRoleProvider" />-->
            </providers>
        </roleManager>

        <profile enabled="true" defaultProvider="YafProfileProvider" inherits="YAF.Utils.YafUserProfile">
            <providers>
                <clear />
                <!-- YAF's ASP.NET Profile Provider is designed to work a bit better with YAF.NET options, but is by no means required.
                    But, you will not be able to switch providers after installing your forum. -->
                <add name="YafProfileProvider" applicationName="YetAnotherForum" connectionStringName="yafnet"
                     type="YAF.Providers.Profile.YafProfileProvider" />
                <!-- Uncomment and set as default if you want to use use the built-in ASP.NET profile provider. -->
                <!--<add name="AspNetSqlProfileProvider" applicationName="YetAnotherForum" connectionStringName="yafnet"
                     type="System.Web.Profile.SqlProfileProvider" />-->
            </providers>
        </profile>

        <!--  Enable it if your application is hosted in a web farm or cluster (e.g. GoDaddy hosting) or you are using standard ASP.NET providers and encryption. 
          IMPORTANT: DO NOT USE THIS KEY! You need to generate your own machine key (google it).
        -->
        <!-- machineKey
        validationKey=""
        decryptionKey=""
        validation="SHA1" decryption="AES"
        /> -->
    </system.web>

    <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <modules>
            <remove name="YafTaskModule" />
            <remove name="UrlRewriter" />
            <add name="YafTaskModule" type="YAF.Core.YafTaskModule, YAF.Core" preCondition="managedHandler" />
            <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter"
                 preCondition="managedHandler" />
        </modules>
        <handlers>
            <add name="YafHandler" preCondition="integratedMode" verb="GET" path="Resource.ashx"
                 type="YAF.YafResourceHandler, YAF" />
        </handlers>
    </system.webServer>
</configuration>
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
10 years ago

There is no maxRequestLength in the web.config .

Originally Posted by: tolox 

Thats why you need to add it


<?xml version="1.0" encoding="utf-8"?>

<configuration>
    <configSections>
        <section name="rewriter"
                 type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter"
                 requirePermission="false" />
    </configSections>

    <connectionStrings configSource="db.config" />

    <appSettings configSource="app.config" />

    <rewriter configSource="URLRewriter.config" />

    <system.net>
        <mailSettings>
            <smtp configSource="mail.config" />
        </mailSettings>
    </system.net>

    <system.web>
      
        <httpRuntime />

        <httpRuntime requestValidationMode="2.0" maxRequestLength="6096" />

        <xhtmlConformance mode="Strict" />

        <customErrors defaultRedirect="Error.aspx" mode="ON" />

        <!--  GLOBALIZATION
            This section sets the globalization settings of the application. 
            Utf-8 is not supported on Netscape 4.x 
            If you need netscape compatiblity leave iso-8859-1.
            UTF-8 is recommended for complex languages
        -->
        <globalization culture="en-US" uiCulture="en" requestEncoding="UTF-8" responseEncoding="UTF-8"
                       fileEncoding="UTF-8" />
        <!--<globalization culture="en-US" uiCulture="en"  fileEncoding="iso-8859-1" requestEncoding="iso-8859-1" responseEncoding="iso-8859-1"/>-->

        <authentication mode="Forms">
            <forms name=".YAFNET_Authentication" protection="All" timeout="43200" cookieless="UseCookies" />
        </authentication>

        <!-- COMPILATION
        * Set debug to "true" to test out the system in development 
        * Set optimizeCompilation to "true" for *MUCH* faster application pool
            restarts on larger .NET systems. But, please read and understand the caveats
            before enabling this settings:
            http://blogs.msdn.com/b/davidebb/archive/2009/04/15/a-new-flag-to-optimize-asp-net-compilation-behavior.aspx             
        -->
        <compilation debug="false" targetFramework="4.0" optimizeCompilations="false">
            <assemblies>
                <add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=" />
                <add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=" />
                <add assembly="System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=" />
                <add assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=" />
                <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=" />
                <add assembly="System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=" />
                <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=" />
                <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=" />
            </assemblies>
        </compilation>

        <httpHandlers>
            <add verb="GET" path="Resource.ashx" type="YAF.YafResourceHandler, YAF" />
        </httpHandlers>

        <httpModules>
            <add name="YafTaskModule" type="YAF.Core.YafTaskModule, YAF.Core" />
            <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter" />
        </httpModules>

        <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" enableEventValidation="false" validateRequest="false">
            <controls>
                <!-- Default: use non-dynamic (compiled classes) in YAF -->
                <add tagPrefix="YAF" namespace="YAF.Controls" assembly="YAF.Controls" />
                <add tagPrefix="YAF" namespace="YAF.Controls.Statistics" assembly="YAF.Controls" />
                <add tagPrefix="YAF" namespace="YAF.Classes" />
                <add tagPrefix="YAF" namespace="YAF" />
            </controls>
            <namespaces>
                <add namespace="YAF.Core" />
                <add namespace="YAF.Controls" />
                <add namespace="YAF.Utils" />
                <add namespace="YAF.Types.Interfaces" />
                <add namespace="YAF.Types" />
            </namespaces>
        </pages>

        <membership defaultProvider="YafMembershipProvider" hashAlgorithmType="SHA1">
            <providers>
                <clear />
                <!-- YAF's ASP.NET Membership Provider is designed to work a bit better with YAF.NET options, but is by no means required.
                    But, you will not be able to switch providers after installing your forum. -->
                <add name="YafMembershipProvider" applicationName="YetAnotherForum" connectionStringName="yafnet"
                     requiresUniqueEmail="true" useSalt="true" type="YAF.Providers.Membership.YafMembershipProvider" />
                
                <!-- Uncommend and set as default if you want to use use the built-in ASP.NET membership provider. Password Type of "Encrypted" requires a machine key. -->
                <!--<add name="AspNetSqlMembershipProvider" applicationName="YetAnotherForum" connectionStringName="yafnet"
                     enablePasswordReset="false" enablePasswordRetrieval="true" maxInvalidPasswordAttempts="5"
                     minRequiredNonalphanumericCharacters="0" minRequiredPasswordLength="5" passwordAttemptWindow="15"
                     passwordFormat="Encrypted" requiresQuestionAndAnswer="false" requiresUniqueEmail="true"
                     type="System.Web.Security.SqlMembershipProvider" />-->
            </providers>
        </membership>

        <roleManager enabled="true" defaultProvider="YafRoleProvider">
            <providers>
                <clear />
                <!-- YAF's ASP.NET Role Provider is designed to work a bit better with YAF.NET options, but is by no means required.
                     But, you will not be able to switch providers after installing your forum. -->
                <add name="YafRoleProvider" applicationName="YetAnotherForum" connectionStringName="yafnet"
                     type="YAF.Providers.Roles.YafRoleProvider" />
                <!-- Uncomment and set as default if you want to use use the built-in ASP.NET role provider. -->
                <!--<add name="AspNetSqlRoleProvider" applicationName="YetAnotherForum" connectionStringName="yafnet"
                     type="System.Web.Security.SqlRoleProvider" />-->
            </providers>
        </roleManager>

        <profile enabled="true" defaultProvider="YafProfileProvider" inherits="YAF.Utils.YafUserProfile">
            <providers>
                <clear />
                <!-- YAF's ASP.NET Profile Provider is designed to work a bit better with YAF.NET options, but is by no means required.
                    But, you will not be able to switch providers after installing your forum. -->
                <add name="YafProfileProvider" applicationName="YetAnotherForum" connectionStringName="yafnet"
                     type="YAF.Providers.Profile.YafProfileProvider" />
                <!-- Uncomment and set as default if you want to use use the built-in ASP.NET profile provider. -->
                <!--<add name="AspNetSqlProfileProvider" applicationName="YetAnotherForum" connectionStringName="yafnet"
                     type="System.Web.Profile.SqlProfileProvider" />-->
            </providers>
        </profile>

        <!--  Enable it if your application is hosted in a web farm or cluster (e.g. GoDaddy hosting) or you are using standard ASP.NET providers and encryption. 
          IMPORTANT: DO NOT USE THIS KEY! You need to generate your own machine key (google it).
        -->
        <!-- machineKey
        validationKey=""
        decryptionKey=""
        validation="SHA1" decryption="AES"
        /> -->
    </system.web>

    <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <modules>
            <remove name="YafTaskModule" />
            <remove name="UrlRewriter" />
            <add name="YafTaskModule" type="YAF.Core.YafTaskModule, YAF.Core" preCondition="managedHandler" />
            <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter"
                 preCondition="managedHandler" />
        </modules>
        <handlers>
            <add name="YafHandler" preCondition="integratedMode" verb="GET" path="Resource.ashx"
                 type="YAF.YafResourceHandler, YAF" />
        </handlers>
    </system.webServer>
</configuration>
tolox
  • tolox
  • 55.4% (Neutral)
  • YAF Forumling Topic Starter
10 years ago
When I add your code the web.config (and restart the website and the yaf applikation) I get a "500 - Internal Servererror".

Btw: I use a Windows Server 2008 R2 and IIS 7.5. Based on the server data and your information i googled that this would be the right code:


<system.webServer>
   <security>
     <requestFiltering>
       <requestLimits maxAllowedContentLength="2147483648" />
     </requestFiltering>
   </security>
 </system.webServer>

But this did not take any effect.

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
10 years ago
Ok to make it easier all you have to do is replace the line

<httpRuntime requestValidationMode="2.0" />

with this...

<httpRuntime requestValidationMode="2.0" maxRequestLength="2147483648" />

But i don't think allowing 2gb files is such a good idea

tolox
  • tolox
  • 55.4% (Neutral)
  • YAF Forumling Topic Starter
10 years ago
This is the result:

Runtime Error

Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a tag within a "web.config" configuration file located in the root directory of the current web application. This tag should then have its "mode" attribute set to "Off".



<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration>

Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's configuration tag to point to a custom error page URL.


<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
</configuration>
tolox
  • tolox
  • 55.4% (Neutral)
  • YAF Forumling Topic Starter
10 years ago
Ok, you were right. 2 GB is too much. With 20MB it works.

:-d Thank you!