Cannot start my static file hosting server in ASP.NET vNext

匿名 (未验证) 提交于 2019-12-03 01:00:01

问题:

I have an very simple ASP.NET vNext just wanted to be a static file server. I had used kvm upgrade to install the latest version and below is my project.json.

{     "dependencies": {         "Helios" : "0.1-alpha-*",         "Microsoft.AspNet.FileSystems": "0.1-alpha-*",         "Microsoft.AspNet.Http": "0.1-alpha-*",         "Microsoft.AspNet.StaticFiles": ""     },     "commands": {         "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:22222"     },     "configurations" : {         "net45" : {         },         "k10" : {             "System.Diagnostics.Contracts": "4.0.0.0",             "System.Security.Claims" :  "0.1-alpha-*"         }     } }

And below is my Startup.cs

using System; using Microsoft.AspNet.Builder;  namespace WebApplication3 {     public class Startup     {         public void Configure(IBuilder app)         {             app.UseStaticFiles();         }     } }

Then when I ran kpm restore I got the error said

Unable to locate Microsoft.AspNet.StaticFiles >= 0.1-alpha-build-0402 Unable to locate Microsoft.AspNet.Diagnostics >= 0.1-alpha-build-0623 Unable to locate Microsoft.AspNet.Hosting >= 0.1-alpha-build-0519 Unable to locate Microsoft.AspNet.Server.WebListener >= 0.1-alpha-build-0469

Below is the result of kvm list.

Active Version              Runtime Architecture Location ------ -------              ------- ------------ --------        0.1-alpha-build-0421 svr50   x86          C:\Users\me\.kre\packages        0.1-alpha-build-0472 svr50   x64          C:\Users\me\.kre\packages        0.1-alpha-build-0472 svr50   x86          C:\Users\me\.kre\packages   *    0.1-alpha-build-0496 svr50   x86          C:\Users\me\.kre\packages

I think I have 0.1-alpha-* installed but why kpm restore told me cannot find.

回答1:

Do you have the AspNet vNext MyGet feed (github.com/aspnet/Home/blob/master/NuGet.Config#L4) configured?



回答2:

Try adding a version to the StaticFiles dependency



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!