NuGet/NuGetGallery — Issue #453: WebException when try to contact NuGet gallery
Author: usarskyy
Created: 2012-03-09 15:02:24+00:00
State: open

Hello,

I have custom code similar to NuGet console application that downloads packages from NuGet Gallery feed v2. Time to time I get strange WebException with status code "MessageLengthLimitExceeded". Here is a part of stack trace:

bei System.Net.HttpWebRequest.GetResponse()
bei NuGet.RequestHelper.GetResponse(Func`1 createRequest, Action`1 prepareRequest, IProxyCache proxyCache, ICredentialCache credentialCache, ICredentialProvider credentialProvider) in C:\Temp\NuGet\src\Core\Http\RequestHelper.cs:Zeile 103.
bei NuGet.HttpClient.GetResponse() in C:\Temp\NuGet\src\Core\Http\HttpClient.cs:Zeile 82.
bei NuGet.RedirectedHttpClient.GetResponseUri(HttpClient client) in C:\Temp\NuGet\src\Core\Http\RedirectedHttpClient.cs:Zeile 70.
bei NuGet.RedirectedHttpClient.EnsureClient() in C:\Temp\NuGet\src\Core\Http\RedirectedHttpClient.cs:Zeile 65.
bei System.Lazy`1.CreateValue()
bei System.Lazy`1.LazyInitValue()
bei System.Lazy`1.get_Value()
bei NuGet.RedirectedHttpClient.get_CachedClient() in C:\Temp\NuGet\src\Core\Http\RedirectedHttpClient.cs:Zeile 57.
bei NuGet.RedirectedHttpClient.get_Uri() in C:\Temp\NuGet\src\Core\Http\RedirectedHttpClient.cs:Zeile 35.
bei NuGet.DataServicePackageRepository.get_Culture() in C:\Temp\NuGet\src\Core\Repositories\DataServicePackageRepository.cs:Zeile 81.
bei NuGet.PackageRepositoryExtensions.FindPackagesById(IPackageRepository repository, String packageId) in C:\Temp\NuGet\src\Core\Repositories\PackageRepositoryExtensions.cs:Zeile 125.
bei NuGet.PackageRepositoryExtensions.FindPackage(IPackageRepository repository, String packageId, SemanticVersion version, IPackageConstraintProvider constraintProvider, Boolean allowPrereleaseVersions) in C:\Temp\NuGet\src\Core\Repositories\PackageRepositoryExtensions.cs:Zeile 73.
bei NuGet.PackageRepositoryExtensions.FindPackage(IPackageRepository repository, String packageId, SemanticVersion version) in C:\Temp\NuGet\src\Core\Repositories\PackageRepositoryExtensions.cs:Zeile 44.
bei NuGet.AggregateRepository.<>c__DisplayClass19.b__16(IPackageRepository r) in C:\Temp\NuGet\src\Core\Repositories\AggregateRepository.cs:Zeile 111.
bei System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
bei System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
bei NuGet.AggregateRepository.FindPackage(String packageId, SemanticVersion version) in C:\Temp\NuGet\src\Core\Repositories\AggregateRepository.cs:Zeile 112.
bei NuGet.PackageRepositoryExtensions.FindPackage(IPackageRepository repository, String packageId, SemanticVersion version, IPackageConstraintProvider constraintProvider, Boolean allowPrereleaseVersions) in C:\Temp\NuGet\src\Core\Repositories\PackageRepositoryExtensions.cs:Zeile 70.
bei NuGet.PackageRepositoryExtensions.FindPackage(IPackageRepository repository, String packageId, SemanticVersion version) in C:\Temp\NuGet\src\Core\Repositories\PackageRepositoryExtensions.cs:Zeile 44.
bei NuGet.PackageRepositoryExtensions.Exists(IPackageRepository repository, String packageId, SemanticVersion version) in C:\Temp\NuGet\src\Core\Repositories\PackageRepositoryExtensions.cs:Zeile 26.

My code is a simple NAnt task that utilizes NuGet.Core library.
Every time I execute this task, it runs inside new NAnt process (created by CC.NET windows service).

The only way to get rid of this annoying exception is to restart CC.NET service that is the main root.

IIS log shows that all requests were completed with 200 code. Also if try to use client on other PC I will not experience any problems.