title: Private Nuget server for asp.net core application
body: <p><a href="https://stackoverflow.com/questions/49568833/nuget-server-for-net-core">Existing related question</a></p>
  
  <p>I want to create a asp.net core application which can be hosted in linux platform which could be used as private nuget repository.</p>
  
  <p>Idea is via this app user can upload nuget packages and in turn to have an url which could be used a nuget package source.</p>
  
  <p>For <strong><em>.Net Framework</em></strong> there is already <strong><em>NugetPackage</em></strong> called <a href="https://www.nuget.org/packages/NuGet.Server/" rel="nofollow noreferrer">Nuget.Server</a> from <strong><em>.NET Foundation</em></strong></p>
  
  <p>However, this does not seem to work in .Net core application.</p>
  
  <p>Even the nuget package <a href="https://www.nuget.org/packages/NuGet.Server.Core/" rel="nofollow noreferrer">Nuget.Server.Core</a> does not seem to work for .net core application.</p>
  
  <p>It would be nice if there was something like Nuget.Server for .Net core application too but nevertheless as a work around this is what I tried</p>
  
  <pre><code>        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
          {
              if (env.IsDevelopment())
              {
                  app.UseDeveloperExceptionPage();
              }
              else
              {
                  app.UseExceptionHandler("/Home/Error");
              }
  
              app.UseStaticFiles();
              app.UseStaticFiles(new StaticFileOptions
              {
                  FileProvider = new PhysicalFileProvider(
                      Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "lib", "NugetPackages")),
                  RequestPath = "/Packages"
              });
  
              app.UseDirectoryBrowser(new DirectoryBrowserOptions
              {
                  FileProvider = new PhysicalFileProvider(
                      Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "lib", "NugetPackages")),
                  RequestPath = "/Packages"
              });
  
              app.UseCookiePolicy();
  
              app.UseMvc(routes =&gt;
              {
                  routes.MapRoute(
                      name: "default",
                      template: "{controller=FileManager}/{action=Index}/{id?}");
              });
          }
  </code></pre>
  
  <p>Here is the url that is mapped
  <img src="https://i.stack.imgur.com/LO5dQ.png" alt="Nuget[4]"></p>
  
  <p>But using that url as nugetpackage source does not work.</p>
  
  <p>I have my asp.net core app running and I have setup nuget source</p>
  
  <p><a href="https://i.stack.imgur.com/ukBYt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ukBYt.png" alt="enter image description here"></a></p>
  
  <p>But I get an error saying</p>
  
  <pre><code>[local] The V2 feed at 'http://localhost:59614/packages/Search()?$filter=IsLatestVersion&amp;searchTerm=''&amp;targetFramework=''&amp;includePrerelease=false&amp;$skip=0&amp;$top=26&amp;semVerLevel=2.0.0' returned an unexpected status code '404 Not Found'.
  </code></pre>
  
  <p>My idea was to have an app(site) from where user can upload nuget packages and I store them in a folder (NugetPackages in this case). And then have a url (pointing to the location where all the packages are uploaded) which could be used as package source in Nuget</p>