fubuMVC HelloWorld 示例中未设置服务定位器
最近我从fubumvc下载了最新的源码。我开始使用“HelloWorld”示例进行一些热身。 不幸的是,每次 FubuPage 类中的 ServiceLocator 都会抛出 NullReferenceException。 首先,我认为应用程序启动可能无法正常运行,但事实并非如此......
有人有什么想法吗?
谢谢
-jan
Line 35: public FubuPage()
Line 36: {
Line 37: _services.OnMissing = type => { return ServiceLocator.GetInstance(type); };
Line 38: }
Line 39:
说明:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其在代码中的来源的更多信息。
异常详细信息:System.NullReferenceException:未将对象引用设置为对象的实例。
recently I downloaded the latest sources from fubumvc. I startet the "HelloWorld" sample for a little warm up.
Unfortunately everytime a NullReferenceException is thrown by the ServiceLocator in the FubuPage class.
First I thought the App-Start might not might not run properly but that's not it...
Anybody any ideas?
Thanks
-jan
Line 35: public FubuPage()
Line 36: {
Line 37: _services.OnMissing = type => { return ServiceLocator.GetInstance(type); };
Line 38: }
Line 39:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据上面的评论,您似乎访问了一个带有“.aspx”扩展名的 URL,该 URL 将视图作为经典 ASP.NET WebForms 请求执行并绕过 FubuMVC(它也会绕过 ASP.NET MVC) 。
确保不要将“.aspx”放在浏览器地址栏中请求 URL 的末尾,这样您将执行 FubuMVC 路由而不是 WebForms 请求。
Based on the comments above, it looks like you were hitting a URL with the ".aspx" extension on it which executes the view as a classic ASP.NET WebForms request and bypasses FubuMVC (and it would bypass ASP.NET MVC as well).
Make sure not to put ".aspx" on the end of your request URLs in the address bar in the browser so that you'll be executing FubuMVC routes and not WebForms requests.