首页 新闻 会员 周边

asp.net core 使用命令启动服务 报错

0
悬赏园豆:20 [已解决问题] 解决于 2018-09-11 11:17

info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
User profile is available. Using 'C:\Users\mayuying\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
Hosting environment: Production
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET http://localhost:5000/
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
Executing action method Souti.Web.Controllers.HomeController.Index (Souti.Web) with arguments ((null)) - ModelState is Valid
fail: Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor[3]
The view 'Index' was not found. Searched locations: /Views/Home/Index.cshtml, /Views/Shared/Index.cshtml
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
Executed action Souti.Web.Controllers.HomeController.Index (Souti.Web) in 32.3144ms
fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[0]
An unhandled exception has occurred: The view 'Index' was not found. The following locations were searched:
/Views/Home/Index.cshtml
/Views/Shared/Index.cshtml

请问我在 vs上访问可以 但是我使用dotnet 命令启动完成功 但是 访问报错 请问是什么原因啊?

马玉溁的主页 马玉溁 | 初学一级 | 园豆:27
提问于:2018-09-02 22:53
< >
分享
最佳答案
0

你是在哪个路径下运行 dotnet run 命令的?

收获园豆:20
dudu | 高人七级 |园豆:30994 | 2018-09-03 09:06

\bin\Debug\netcoreapp2.0 下执行的

马玉溁 | 园豆:27 (初学一级) | 2018-09-03 09:43

@马玉溁: 应该在 Web 项目所在的文件夹中直接运行 dotnet run

dudu | 园豆:30994 (高人七级) | 2018-09-03 09:46

@dudu: 嗯 这样是可以的 我在 项目的 目录里先 build 然后在run 就可以了 ; 我之前 是用的 dotnet web.dll 是可以启动的 我是从网上看的 但是 为什么会报错 能说一下 原因吗? 谢谢

马玉溁 | 园豆:27 (初学一级) | 2018-09-03 10:18

@马玉溁: \bin\Debug\netcoreapp2.0 中没有视图文件,如果使用 dotnet web.dll 运行,需要先用 dotnet publish 命令进行发布,发布的目标文件夹中会包含视图文件

dudu | 园豆:30994 (高人七级) | 2018-09-03 10:25

@dudu:您好系我想问一下我发布到linux 以后 也能运行期来项目 但是 会有一个警告
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
No XML encryptor configured. Key {52feaee2-ad3f-44a4-a545-a7550bcc1a98} may be persisted to storage in unencrypted form. 这个是什么原因呢 有没有影响呢? 谢谢

马玉溁 | 园豆:27 (初学一级) | 2018-09-04 21:02

@dudu: 好的谢谢dudu

马玉溁 | 园豆:27 (初学一级) | 2018-09-11 11:17
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册