use*_*499 13 nuget nuget-server
我按照说明设置和托管我自己的NuGet提要.我在Windows 2012(IIS 8.5)框中运行Web应用程序.
我构建并运行解决方案并获取default.aspx页面...
其中显示"您正在运行NuGet.Server v2.8.60318.667"和"单击此处查看您的包".
当我点击"这里"链接时,我得到一个"404 - 文件或目录未找到".错误.
Web.Config具有以下条目
<modules runAllManagedModulesForAllRequests="true">
Run Code Online (Sandbox Code Playgroud)web.config还有一个用于将.nupkg扩展名注册为mimeType ="application/zip"的条目
看起来网址路由不起作用,但我似乎无法确定我做错了什么.有些事情阻止了odata饲料的运转.
我知道NuGet服务器有很好的第三方实现,但我真的想让免费的一个工作,看起来应该这么简单.任何想法或疑难解答提示将不胜感激.
和他一样,我也是从一个 VB 项目开始的,最后我和 OP 属于同一阵营。然而,对我有用的是将这两个文件中的所有 C# 代码转换为 VB。
为了完整起见,我在下面包含了这些文件的转换后内容。
<%@ Page Language="VB" %>
<%@ Import Namespace="NuGet.Server" %>
<%@ Import Namespace="NuGet.Server.App_Start" %>
<%@ Import Namespace="NuGet.Server.Infrastructure" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>NuGet Private Repository</title>
<style>
body { font-family: Calibri; }
</style>
</head>
<body>
<div>
<h2>You are running NuGet.Server v<%= Gettype(NuGetODataConfig).Assembly.GetName().Version %></h2>
<p>
Click <a href="<%= VirtualPathUtility.ToAbsolute("~/nuget/Packages") %>">here</a> to view your packages.
</p>
<fieldset style="width:800px">
<legend><strong>Repository URLs</strong></legend>
In the package manager settings, add the following URL to the list of
Package Sources:
<blockquote>
<strong><%= Helpers.GetRepositoryUrl(Request.Url, Request.ApplicationPath) %></strong>
</blockquote>
<% if string.IsNullOrEmpty(ConfigurationManager.AppSettings("apiKey")) Then %>
To enable pushing packages to this feed using the <a href="https://www.nuget.org/downloads">NuGet command line tool</a> (nuget.exe), set the <code>apiKey</code> appSetting in web.config.
<% else %>
Use the command below to push packages to this feed using the <a href="https://www.nuget.org/downloads">NuGet command line tool</a> (nuget.exe).
<blockquote>
<strong>nuget.exe push {package file} {apikey} -Source <%= Helpers.GetPushUrl(Request.Url, Request.ApplicationPath) %></strong>
</blockquote>
<% end if %>
</fieldset>
<% if Request.IsLocal Then %>
<fieldset style="width:800px">
<legend><strong>Adding packages</strong></legend>
To add packages to the feed put package files (.nupkg files) in the folder
<code><% = PackageUtility.PackagePhysicalPath %></code><br/><br/>
Click <a href="<%= VirtualPathUtility.ToAbsolute("~/nuget/clear-cache") %>">here</a> to clear the package cache.
</fieldset>
<% End If %>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
Imports System.Net.Http
Imports System.Web.Http
Imports System.Web.Http.ExceptionHandling
Imports System.Web.Http.Routing
Imports NuGet.Server
Imports NuGet.Server.Infrastructure
Imports NuGet.Server.V2
<Assembly: WebActivatorEx.PreApplicationStartMethod(GetType(MGINuGet.App_Start.NuGetODataConfig), "Start")>
Namespace MGINuGet.App_Start
Public Module NuGetODataConfig
Public Sub Start()
ServiceResolver.SetServiceResolver(New DefaultServiceResolver())
Dim config As HttpConfiguration = GlobalConfiguration.Configuration
NuGetV2WebApiEnabler.UseNuGetV2WebApiFeed(config, "NuGetDefault", "nuget", "PackagesOData")
config.Services.Replace(GetType(IExceptionLogger), New TraceExceptionLogger())
Trace.Listeners.Add(New TextWriterTraceListener(System.Web.Hosting.HostingEnvironment.MapPath("~/NuGet.Server.log")))
Trace.AutoFlush = True
config.Routes.MapHttpRoute(name:="NuGetDefault_ClearCache",
routeTemplate:="nuget/clear-cache",
defaults:=New With {Key .controller = "PackagesOData", Key .action = "ClearCache"},
constraints:=New With {Key .httpMethod = New HttpMethodConstraint(HttpMethod.Get)})
End Sub
End Module
End Namespace
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7434 次 |
| 最近记录: |