我们有一个内部NuGet服务器(使用NuGet.Server包的ASP.net应用程序),我们希望将其与八达通一起使用来部署软件包。所以你遇到的第一件事就是包太大了。
当你推送一个大于大约7兆的包时,你会得到:无法处理请求。‘请求实体太大’。远程服务器返回错误:(413)请求实体太大..
基于八达通的文档,我更新了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>
这是行不通的。其他帖子谈到运行类似(IIS7)的东西: appcmd.exe set config -section:system.webServer/serverRuntime /uploadReadAheadSize:"419430400“/commit:apphost
或者(IIS6):cscript adsutil.vbs set w3svc/1/uploadreadaheadsize 419430400
我两个都试过了,但都没有用。这两个命令都没有返回错误,所以我假设值'419430400‘对于所有调用都是正确的(字节与其他大小单位)。
有人知道我错过了什么吗?
我最终只是将包复制到web服务器上的一个共享位置,但我真的希望push命令能起作用。
谢谢。
发布于 2013-07-23 22:36:06
没有准确地回答OP的问题,但与主题相关,我在使用NuGet push
推送到本地SymbolSource服务器时收到(413) Request Entity Too Large
错误-结果是我提交的URL略有错误,一旦我更正了指向基本/NuGet/
URL的命令,它就运行得很好。
我不知道为什么不正确的URL会导致413错误,但这就对了。希望这对某些人有帮助。
编辑:根据下面的评论,你可能更幸运的是只引用了基本的http://www.myserver.com/
地址,而不是包括/NuGet。值得玩玩一下。
发布于 2020-05-22 16:37:04
我也有同样的问题:
[Step 1/2] Publishing package to feed at http://localhost/OctopusDeploy/nuget/packages...
[Step 1/2] Failed to push to package feed at 'http://localhost/OctopusDeploy/nuget/packages/'.
[Step 1/2] (The server responded with: [413] Request Entity Too Large)
[Step 1/2] Process exited with code 1
但这是因为八达通部署服务已停止!
发布于 2021-08-13 09:22:47
这是由于nginx的限制,Linux系统中的nuget服务器使用nginx作为代理,配置文件位于:
/etc/nginx/conf.d/nuget.conf
server_name localhost;
root /var/www/public/;
client_max_body_size 200M;
change client_max_body_size 200M正在为我工作。
https://stackoverflow.com/questions/11264902
复制相似问题