Existing related question
我想创建一个asp.net核心应用程序,可以托管在linux平台上,可以作为私有nuget存储库使用。
为
.Net框架
已经有了
打电话
Nuget.Server
从
.NET基础
Nuget.Server.Core
似乎不适用于.net核心应用程序。
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 =>
{
routes.MapRoute(
name: "default",
template: "{controller=FileManager}/{action=Index}/{id?}");
});
}
这是映射的url
但是使用这个url作为nugetpackage源代码是行不通的。
我有我的asp.net核心应用正在运行,我已经安装了nuget源
但我有个错误说
[local] The V2 feed at 'http://localhost:59614/packages/Search()?$filter=IsLatestVersion&searchTerm=''&targetFramework=''&includePrerelease=false&$skip=0&$top=26&semVerLevel=2.0.0' returned an unexpected status code '404 Not Found'.
我的想法是有一个应用程序(网站),用户可以从那里上传nuget包,我将它们存储在一个文件夹中(本例中是NugetPackages)。然后有一个url(指向所有包上载的位置),它可以在Nuget中用作包源