Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Private NuGet Server: Request Entity Too Large

Tags:

wcf

nuget

We have a internal NuGet server (ASP.net app using the NuGet.Server package) and we want to use it with Octopus to deploy packages. So the first thing you hit is that the packages are too large.

When you push a package larger than around 7 Meg you get: Failed to process request. 'Request Entity Too Large'. The remote server returned an error: (413) Request Entity Too Large..

Based on the documentation on Octopus, I updated the web.config file to have the changes.

<configuration>
    <configSections>
        <sectionGroup name="elmah">
            <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah"/>
            <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah"/>
            <section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah"/>
            <section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah"/>
        </sectionGroup>
    </configSections>
    <system.web>
        <compilation debug="true" targetFramework="4.0"/>
        <httpModules>
            <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
            <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah"/>
            <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah"/>
        </httpModules>
        <httpRuntime maxRequestLength="419430400" executionTimeout="3600"/>
    </system.web>
    <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
        <modules runAllManagedModulesForAllRequests="true">
            <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler"/>
            <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler"/>
            <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler"/>
        </modules>
        <staticContent>
            <mimeMap fileExtension=".nupkg" mimeType="application/zip"/>
        </staticContent>
        <security>
            <requestFiltering>
                <requestLimits maxAllowedContentLength="419430400"/>
            </requestFiltering>
        </security>
    </system.webServer>
    <elmah>
        <security allowRemoteAccess="false"/>
        <errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data"/>
    </elmah>
    <location path="elmah.axd" inheritInChildApplications="false">
        <system.web>
            <httpHandlers>
                <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah"/>
            </httpHandlers>
        </system.web>
        <system.webServer>
            <handlers>
                <add name="ELMAH" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode"/>
            </handlers>
        </system.webServer>
    </location>
    <appSettings>
        <add key="apiKey" value="KeyHere"/>
        <add key="packagesPath" value=""/>
    </appSettings>
    <system.serviceModel>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
    </system.serviceModel>
</configuration>

That does not work. Other posts talk about running something like (IIS7): appcmd.exe set config -section:system.webServer/serverRuntime /uploadReadAheadSize:"419430400" /commit:apphost

or (IIS6): cscript adsutil.vbs set w3svc/1/uploadreadaheadsize 419430400

I tried both to no avail. Neither command returned an error, so I assume that the value '419430400' is correct for all of the calls (bytes vs. some other unit of size).

Anyone have any idea what I am missing?

I ended up just copying the package to a share on the web server, but I would really like the push command to work.

Thanks.

like image 800
Tyrel Van Niekerk Avatar asked Jun 29 '12 15:06

Tyrel Van Niekerk


People also ask

How do I access private NuGet packages?

Consume your private NuGet Feed Just copy your package source URL, go to Visual Studio, open the NuGet Package Manager, go to its settings and add a new source. Choose a fancy name, insert the source URL. Done.

Where are private NuGet packages stored?

You can also make private packages available to only a team or organization by hosting them on a file share, a private NuGet server, or a third-party repository such as myget, ProGet, Nexus Repository, or Artifactory. For more information, see Host your own NuGet feeds.


1 Answers

Not exactly answering the OP's question, but related to the topic, I was getting the (413) Request Entity Too Large error while using NuGet push to push to a local SymbolSource server - turned out I was submitting to a slightly incorrect URL, once I corrected the command to point to the base /NuGet/ URL, it ran just fine.

No idea why an incorrect URL results in the 413 error, but there you go. Hope this helps someone.

EDIT: based on comments below, you may have more luck just referencing the base http://www.myserver.com/ URL rather than including the /NuGet as well. Worth playing around a bit.

like image 75
keithl8041 Avatar answered Sep 26 '22 23:09

keithl8041