【问题标题】:NuGet Push Failure in TFS buildTFS 构建中的 NuGet 推送失败
【发布时间】:2017-03-27 19:42:11
【问题描述】:

前言:我在 Windows 2012 R2 / IIS 8.5 上运行 NuGet Server (2.11.3)。 NuGet 服务器在单独的文件服务器(共享文件夹)中管理其包文件夹。 此外,我正在运行 TFS 构建机器(来自 TFS 2015 的代理),该机器使用此 nuget 服务器进行还原和推送活动。自然,每个构建最初都会读取目标解决方案 >>> 项目 >>> packages.config 文件并从 nuget 服务器恢复配置的包。在后期,代理生成所需的 *.nupkg 文件并将它们推送到同一 nuget 服务器的 nuget 端点。这些是其他解决方案的依赖项。

问题:大部分解决方案运行正常,没有任何特殊问题。有几个解决方案,其中只有 1-3 个项目,TFS 构建失败并显示以下消息:

Response status code does not indicate success: 500 (Internal Server Error).
Unexpected exit code 1 returned from tool NuGet.exe

nuget 服务器上的 IIS 日志如下所示:

2017-03-27 16:47:26 192.168.2.116 PUT /MainRepository/nuget/ - 80 - 192.168.1.30 NuGet+Command+Line/3.5.0+(Microsoft+Windows+NT+6.2.9200.0) - 500 0 0 15
2017-03-27 16:47:26 192.168.2.116 PUT /MainRepository/nuget/ - 80 - 192.168.1.30 NuGet+Command+Line/3.5.0+(Microsoft+Windows+NT+6.2.9200.0) - 500 0 0 15
2017-03-27 16:47:26 192.168.2.116 PUT /MainRepository/nuget/ - 80 - 192.168.1.30 NuGet+Command+Line/3.5.0+(Microsoft+Windows+NT+6.2.9200.0) - 500 0 0 31

在 nuget 服务器中记录了以下事件(显示在事件查看器中):

Event code: 3005 
Event message: An unhandled exception has occurred. 
Event time: 27/03/2017 10:40:17 
Event time (UTC): 27/03/2017 07:40:17 
Event ID: cb897ce6dc2f4e40a07c71a9160718f2 
Event sequence: 2073 
Event occurrence: 4 
Event detail code: 0 

Application information: 
    Application domain: /LM/W3SVC/1/ROOT/MainRepository-1-131350724531418170 
    Trust level: Full 
    Application Virtual Path: /MainRepository 
    Application Path: C:\inetpub\wwwroot\NugetServerInternal\ 
    Machine name: NUGET-SRV 

Process information: 
    Process ID: 2512 
    Process name: w3wp.exe 
    Account name: some.domain/some.user 

Exception information: 
    Exception type: IndexOutOfRangeException 
    Exception message: Index was outside the bounds of the array.
   at System.Web.HttpRawUploadedContent.get_Item(Int32 index)
   at System.Web.HttpMultipartContentTemplateParser.GetNextLine()
   at System.Web.HttpMultipartContentTemplateParser.ParseIntoElementList()
   at System.Web.HttpMultipartContentTemplateParser.Parse(HttpRawUploadedContent data, Int32 length, Byte[] boundary, Encoding encoding)
   at System.Web.HttpRequest.GetMultipartContent()
   at System.Web.HttpRequest.FillInFilesCollection()
   at System.Web.HttpRequest.EnsureFiles()
   at System.Web.HttpRequest.get_Files()
   at System.Web.HttpRequestWrapper.get_Files()
   at NuGet.Server.Publishing.PackageService.CreatePackage(HttpContextBase context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Request information: 
    Request URL: http://nuget-srv/MainRepository/nuget/ 
    Request path: /MainRepository/nuget/ 
    User host address: 192.168.1.30 
    User:  
    Is authenticated: False 
    Authentication Type:  
    Thread account name: some.domain/some.user 

Thread information: 
    Thread ID: 19 
    Thread account name: some.domain/some.user 
    Is impersonating: False 
    Stack trace:    at System.Web.HttpRawUploadedContent.get_Item(Int32 index)
   at System.Web.HttpMultipartContentTemplateParser.GetNextLine()
   at System.Web.HttpMultipartContentTemplateParser.ParseIntoElementList()
   at System.Web.HttpMultipartContentTemplateParser.Parse(HttpRawUploadedContent data, Int32 length, Byte[] boundary, Encoding encoding)
   at System.Web.HttpRequest.GetMultipartContent()
   at System.Web.HttpRequest.FillInFilesCollection()
   at System.Web.HttpRequest.EnsureFiles()
   at System.Web.HttpRequest.get_Files()
   at System.Web.HttpRequestWrapper.get_Files()
   at NuGet.Server.Publishing.PackageService.CreatePackage(HttpContextBase context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

注意:根据我的检查,有时包是在包文件夹中创建的,有时不是。 注意:我很确定所有配置都已到位(包括 API 密钥等)。当然,很高兴知道缺少什么。

将不胜感激任何关于这个的建议。

提前非常感谢, 提供

【问题讨论】:

  • 忘了提到,根据我的检查,失败和通过的 nuspec 文件看起来都是一样的,除了失败的文件中的其他依赖项,我正在尝试与开发团队进行调查。
  • 可能是您要安装的软件包有问题。对于那1-3个项目,您是否测试过安装其他nuget包,也许是一个简单的包,它可以安装成功吗?如果其他项目使用这个包得到同样的错误?
  • 出现此问题时请使用Fiddler等工具监控网络。网络有问题吗?
  • 感谢您的提示。我试图找出(使用wireshark)坏和好的推送请求之间的差距。会及时通知您。
  • 推送前有没有增加包版本?

标签: tfs build nuget push


【解决方案1】:

虽然答案很差,但仍然可以帮助你们遇到的任何潜在问题:-)。

我意识到我的“有问题的”推送请求对新创建的 NuGet 服务器起作用。新的也是 Windows Server 2012 R2。我刚刚将它清理干净并仅添加了必要的 Windows 功能以支持针对 Nuget 服务器的 IIS/Web 操作。

如果我没记错的话,它只是 ASP.NET 4.5。

最好的问候, 提供

【讨论】:

    猜你喜欢
    • 2018-10-15
    • 2017-08-16
    • 1970-01-01
    • 2011-01-15
    • 1970-01-01
    • 2019-01-04
    相关资源
    最近更新 更多