搭建公司内部的NuGet服务器

1.  创建NuGet项目
     (注意:解决方案名称可以自定义为其他的名称)
      

  

2.   安装NuGet Server
      在 “NuGetServer” 项目上,右键选择 “管理NuGet程序包” ,选择 “联机” ,右上角搜索框中输入“NuGet.Server”  Enter,在搜索结果中选择 NuGet.Server 项,进行安装即可(如下图所示)。
      注意:如果安装最后,提示 替换 Web.config ,请选择“全是”。
      

 

3.  编译NuGet Server项目
     编译“NuGetServer”项目,如果没有出异常,这里就创建项目完成,NuGetServer 就这么简单建成
     注意: 如果一直编译不过的话,则尝试多更新几次Nuget.Server包(卸载重新安装)。
     
4. 配置文件说明(Web.config)
    web.config->appSettings的各项配置说明:
    packagesPath:这个Key表示Nuget包的存放目录,默认情况下存放在部署的网站根目录Packages文件夹
    requireApiKey: 这个key 如果设置成 true ,表示apiKey是必须要设置的,这个就像密码一样。可以阻止不知道这个apiKey人访问到程序包
    apiKey:  是作为一个密钥,防止其他人来访问我们的Nuget服务(NuGet Package Explorer来访问的时候也许要填入我们预先设置好的密钥才能够进行访问)
    
 1 <?xml version="1.0" encoding="utf-8"?>
 2 <!--  For more information on how to configure your ASP.NET application, please visit  http://go.microsoft.com/fwlink/?LinkId=169433  -->
 3 <configuration>
 4   <appSettings>
 5     <!-- Determines if an Api Key is required to push\delete packages from the server.  -->
 6     <add key="requireApiKey" value="true" />
 7 
 8     <!-- 
 9     Set the value here to allow people to push/delete packages from the server.
10     NOTE: This is a shared key (password) for all users.
11     -->
12     <add key="apiKey" value="ChinaNet910111" />
13     <!--
14     Change the path to the packages folder. Default is ~/Packages.
15     This can be a virtual or physical path.
16     -->
17     <add key="packagesPath" value="~/Packages" />
18 
19     <!--
20     Set allowOverrideExistingPackageOnPush to false to mimic NuGet.org's behaviour (do not allow overwriting packages with same id + version).
21     -->
22     <add key="allowOverrideExistingPackageOnPush" value="false" />
23 
24     <!--
25     Set ignoreSymbolsPackages to true to filter out symbols packages. Since NuGet.Server does not come with a symbol server,
26     it makes sense to ignore this type of packages. When enabled, files named `.symbols.nupkg` or packages containing a `/src` folder will be ignored.
27     
28     If you only push .symbols.nupkg packages, set this to false so that packages can be uploaded.
29     -->
30     <add key="ignoreSymbolsPackages" value="true" />
31 
32     <!--
33     Set enableDelisting to true to enable delist instead of delete as a result of a "nuget delete" command.
34     - delete: package is deleted from the repository's local filesystem.
35     - delist: 
36       - "nuget delete": the "hidden" file attribute of the corresponding nupkg on the repository local filesystem is turned on instead of deleting the file.
37       - "nuget list" skips delisted packages, i.e. those that have the hidden attribute set on their nupkg.
38       - "nuget install packageid -version version" command will succeed for both listed and delisted packages.
39         e.g. delisted packages can still be downloaded by clients that explicitly specify their version.
40     -->
41     <add key="enableDelisting" value="false" />
42 
43     <!--
44     Set enableFrameworkFiltering to true to enable filtering packages by their supported frameworks during search.
45     -->
46     <add key="enableFrameworkFiltering" value="false" />
47 
48     <!--
49     When running NuGet.Server in a NAT network, ASP.NET may embed the erver's internal IP address in the V2 feed.
50     Uncomment the following configuration entry to enable NAT support.
51     -->
52     <!-- <add key="aspnet:UseHostHeaderForRequestUrl" value="true" /> -->
53   </appSettings>
54   <system.web>
55     <httpRuntime maxRequestLength="31457280" />
56     <compilation debug="true" />
57   </system.web>
58   <system.serviceModel>
59     <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
60   </system.serviceModel>
61   <system.webServer>
62     <staticContent>
63       <mimeMap fileExtension=".nupkg" mimeType="application/zip" />
64     </staticContent>
65     <modules runAllManagedModulesForAllRequests="true">
66     </modules>
67   </system.webServer>
68 </configuration>
web.config

 

5. 部署IIS站点
   假设我们部署站点的端口是10000,那么部署成功以后我们就可以通过 http://xxx.xxx.xxx.xxx:10000去访问我们的Nuget服务了(下面则是我们部署成功后的效果图)
   

 

转载于:https://www.cnblogs.com/rakers/p/7834669.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值