我尝试使用 vNext 和 k run
启动 Web 项目,但它不起作用;当我将 localhost:port 放入浏览器时,它没有给我任何网页!
我克隆了https://github.com/aspnet/Home/tree/master/samples/HelloWeb将内容(json 和 cs 文件)放入目录中,在此目录中运行命令提示符并执行:
kpm restore
k run
现在控制台显示
Demo does not contain a static 'Main' method suitable for any endpoint
所以看起来它有效,但是如果我转到“web”下的 json 中的 localhost:port,我的浏览器会显示一个错误页面(未找到)。
如何调试这个?
kvm list
显示 1.0.0-beta2 CLR x86 已设置为事件状态并使用默认别名。
最佳答案
这是k web
,而不是k run
。后者用于控制台应用程序。
如 aspnet/Home on GitHub 上所述:
Run the sample using the appropriate K command:
- For the console app run
k run
.- For the web apps run
k web
on Windows ork kestrel
on Mono.
关于asp.net - 无法在 helloweb 演示应用程序上运行 k run,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28538795/