遇到此处所述的问题https://github.com/NancyFx/Nancy/issues/1528
具体来说,即使我按照我所理解的正确配置包括Razor View引擎,它也不会始终有效。自托管。
奇怪的是,我没有在我的Mac(Mono / Xamarin特定版本)或2台测试机器(windows / windows build)上遇到任何问题 - 它们工作得非常好 - 但是其他2台测试机器(windows / windows build)确实遇到过问题。
难以确定为何会出现这种情况
使用.NET 4.5
肯定有RAZOR引擎DLL存在,甚至在引导程序中强制引用(并且没有抛出异常)
任何线索?谢谢!
编辑1:这是完整的堆栈跟踪,如请求的那样。我随后将其更改为明确的" index.cshtml'但报告的错误基本相同(您只需在消息中的索引后看到.cshtml)。请注意缺少cshtml作为支持的视图扩展
Nancy.RequestExecutionException: Oh noes! ---> Nancy.ViewEngines.ViewNotFoundException: Unable to locate view 'index'
Currently available view engine extensions: sshtml,html,htm
Locations inspected: views/Home/index-en-US,views/Home/index,Home/index-en-US,Home/index,views/index-en-US,views/index,index-en-US,index
Root path: XXX
If you were expecting raw data back, make sure you set the 'Accept'-header of the request to correct format, for example 'application/json'
at Nancy.ViewEngines.DefaultViewFactory.GetRenderedView(String viewName, Object model, ViewLocationContext viewLocationContext)
at Nancy.ViewEngines.DefaultViewFactory.RenderView(String viewName, Object model, ViewLocationContext viewLocationContext)
at Nancy.Responses.Negotiation.ViewProcessor.Process(MediaRange requestedMediaRange, Object model, NancyContext context)
at Nancy.Responses.Negotiation.DefaultResponseNegotiator.NegotiateResponse(IEnumerable`1 compatibleHeaders, NegotiationContext negotiationContext, NancyContext context)
at Nancy.Responses.Negotiation.DefaultResponseNegotiator.CreateResponse(IList`1 compatibleHeaders, NegotiationContext negotiationContext, NancyContext context)
at Nancy.Responses.Negotiation.DefaultResponseNegotiator.NegotiateResponse(Object routeResult, NancyContext context)
at Nancy.Routing.DefaultRouteInvoker.<>c__DisplayClass9.b__5(Task`1 completedTask)
--- End of inner exception stack trace ---
at Nancy.NancyEngine.InvokeOnErrorHook(NancyContext context, ErrorPipeline pipeline, Exception ex)