NuGet.Server error "File contains corrupted data" on PUT package on remote server only
See original GitHub issueHi!
NuGet.Server (method PackageService.CreatePackage) throws error “File contains corrupted data” on PUT package on remote server only, in IIS hosted application (created by instruction http://nugetserver.net/), but locally all works correctly. It reproducing for any package. Server: Windows Server 2008 R2, .NET 4.5, IIS 7.5, configured application pool with .NET Framework v4.0.30319, managed pipeline mode Integrated. NuGet.Server v2.11.1.0, nuget.exe version 3.4.3.855. Exception:
System.IO.FileFormatException: File contains corrupted data.
at MS.Internal.IO.Zip.ZipIOEndOfCentralDirectoryBlock.FindPosition(Stream archiveStream)
at MS.Internal.IO.Zip.ZipIOBlockManager.LoadEndOfCentralDirectoryBlock()
at MS.Internal.IO.Zip.ZipArchive.OpenOnStream(Stream stream, FileMode mode, FileAccess access, Boolean streaming)
at System.IO.Packaging.ZipPackage..ctor(Stream s, FileMode mode, FileAccess access, Boolean streaming)
at System.IO.Packaging.Package.Open(Stream stream, FileMode packageMode, FileAccess packageAccess, Boolean streaming)
at System.IO.Packaging.Package.Open(Stream stream)
at NuGet.OptimizedZipPackage.EnsureManifest()
at NuGet.Server.Publishing.PackageService.CreatePackage(HttpContextBase context)
at NuGetServer.NuGetRoutes.PushPackage(RequestContext context)
Research shown that problem can be with content type “multipart/form-data”, but we cannot recognize - problem in server, or in RouteMagic+NuGet.Server, or in both. On local machine/devIIS in debug HttpContext.Request.Files has 1 file with package, therefore CreatePackage works as expected. On server HttpContext.Request.Files are empty, but InputStream contains all neccessary headers + data. Requests headers/data on local and server - identical:
PUT /api/package/ HTTP/1.1
Connection: Keep-Alive
Content-Length: 128432
Content-Type: multipart/form-data; boundary="ec6ee113-c37c-4fdc-8f02-2ab7fd2de007"
Accept-Encoding: gzip, deflate
Expect: 100-continue
Host: test.com
User-Agent: NuGet Command Line/3.4.3.855 (Microsoft Windows NT 6.1.7601 Service Pack 1)
X-NuGet-ApiKey: test
--ec6ee113-c37c-4fdc-8f02-2ab7fd2de007
Content-Type: application/octet-stream
Content-Disposition: form-data; name=package; filename=package.nupkg; filename*=utf-8''package.nupkg
PK „yєHqFу§ ... ZIP package... [Content_Types].xmlPK „yєH–Эѓб н Q =п package/services/metadata/core-properties/e4bb51182ca14486b1a306374401d6fb.psmdcpPK
) Ќс
--ec6ee113-c37c-4fdc-8f02-2ab7fd2de007--
Were suspected case described here http://forums.iis.net/t/1229356.aspx?Windows+Update+breaks+multipart+form+data, but update KB3104002 are not installed on the server. We will be very grateful if you help to understand because of what it is a problem. Perhaps the reason only properly configured server, but we already no have any ideas. Thank you in advance!
Issue Analytics
- State:
- Created 7 years ago
- Comments:16 (8 by maintainers)
Top GitHub Comments
Thanks all for your help!
Seems NuGet 3.3 and higher touches a server-side feature that is only available in .NET 4.6. Please upgrade your server .NET framework to use .NET 4.6 or higher.
We will be fixing this in the NuGet.Server package as well - https://github.com/NuGet/NuGetGallery/issues/3063
.NET is 4.6.1. I have uploaded the fiddler logs and sent through support, maybe they will help.
Will try tomorrow or today later to alter the web.config and report results. One thing I already have is the <remove name='WebDAV'/> to fix the issue when push returned 405 (Method not allowed).