loic-sharma / BaGet

A lightweight NuGet and symbol server
https://loic-sharma.github.io/BaGet/
MIT License
2.57k stars 641 forks source link

Cannot import local storage nugets via Nuget.Server import #599

Open AlbertoBN opened 3 years ago

AlbertoBN commented 3 years ago

Describe the bug

I have a local storage feed run under Nuget.Server. I am trying to upgrade to BaGet and no matter what I do I get an error. BaGet is running behind IIS. Tried in console and IIS mode with no results

To Reproduce

Steps to reproduce the behavior:

  1. Using this version of BaGet 'v0.3.0-preview4'
  2. Running the script from the Nuget.Server folder as per the documentation for importing Nuget.Server
  3. With these arguments - as per documentation
  4. See error - redacted
nuget.exe push -Source http://localhost:5060/v3/index.json "Packages\***********.nupkg"
Pushing ******** to 'http://localhost:5060/v3/index.json'...
Failed to process request. 'Method Not Allowed'.
The remote server returned an error: (405) Method Not Allowed..

Expected behavior

Packages are pushed and visible in BaGet UI

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Console error


      Executing endpoint '405 HTTP Method Not Supported'
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
      Executed endpoint '405 HTTP Method Not Supported'
dbug: Microsoft.AspNetCore.Routing.Matching.DfaMatcher[1001]
      1 candidate(s) found for the request path '/v3/index.json'
dbug: Microsoft.AspNetCore.Routing.Matching.DfaMatcher[1005]
      Endpoint 'BaGet.Hosting.ServiceIndexController.GetAsync (BaGet.Hosting)' w
ith route pattern 'v3/index.json' is valid for the request path '/v3/index.json'

dbug: Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware[1]
      Request matched endpoint 'BaGet.Hosting.ServiceIndexController.GetAsync (B
aGet.Hosting)'```
AlbertoBN commented 3 years ago

Found a workaround in the import script replace

Write-Host "nuget.exe push -Source $destination ""$path""" & nuget.exe push -Source $destination $path

With

Write-Host "dotnet push -k <apikeyifyouhave> -s $destination ""$path""" & dotnet push -k <apikeyifyouhave> -s $destination ""$path"""

Maybe the documentation is outdated?