私有NuGet服务器:请求实体太大

Tyr*_*erk 17 wcf nuget

我们有一个内部NuGet服务器(使用NuGet.Server软件包的ASP.net应用程序),我们希望将它与Octopus一起用于部署软件包.所以你遇到的第一件事就是包太大了.

当您推送大于7兆的包时,您会得到:无法处理请求.'请求的实体太大'.远程服务器返回错误:(413)请求实体太大..

根据Octopus上的文档,我更新了web.config文件以进行更改.

<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>
Run Code Online (Sandbox Code Playgroud)

这不起作用.其他帖子谈论运行类似(IIS7)的东西:appcmd.exe set config -section:system.webServer/serverRuntime/uploadReadAheadSize:"419430400"/ commit:apphost

或(IIS6):cscript adsutil.vbs设置w3svc/1/uploadreadaheadsize 419430400

我试过两个都无济于事.两个命令都没有返回错误,所以我假设值'419430400'对于所有调用都是正确的(字节与其他一些大小的单位).

任何人都知道我错过了什么?

我最终只是将包复制到Web服务器上的共享,但我真的希望push命令工作.

谢谢.

kei*_*041 35

不完全回答OP的问题,但是与主题相关,我(413) Request Entity Too Large在使用NuGet push推送到本地SymbolSource服务器时收到错误- 结果我提交了稍微不正确的URL,一旦我更正命令指向基本/NuGet/URL ,它运行得很好.

不知道为什么错误的URL会导致413错误,但是你去了.希望这有助于某人.

编辑:根据下面的评论,你可能有更多的运气只是引用基本http://www.myserver.com/URL而不是包括/ NuGet.值得玩一下.

  • 对于我的情况,我必须删除`/ NuGet`并且只有基本URL:`http:// localhost:56211` (9认同)

Dar*_*usz 7

我知道这是一个老问题,但今天我遇到了同样的错误.值得注意的是我正在使用TeamCity包构建和发布.无论如何,当我尝试Publish我的大包(大约200 MB)时,我被阻止了.解决方案很简单:

而不是发布http://mynugetserver/api/v2/,使用: http://mynugetserver/


maa*_*nba 2

你必须将这些人设置为更高的值:

  • system.web - httpRuntime - maxRequestLength 为 1048576
  • system.webserver - 安全 - requestFiltering - requestLimits - maxAllowedContentLength 到,比如说 1073741824

两个值的单位不同,因此第二个值应大于第一个值。

另外,请查看 www.myget.org,我在使用 Octopus Deploy 时发现它很棒。