Asp.net mvc 4 未找到从1.2-shell.html升级到Durandal 2.0

Asp.net mvc 4 未找到从1.2-shell.html升级到Durandal 2.0,asp.net-mvc-4,durandal,Asp.net Mvc 4,Durandal,我在尝试激活shell时遇到404错误。它似乎找到了shell.js,但随后表明它找不到shell.html,因为它找错了位置 我试图强迫公约明确地告诉它去哪里看,但它仍然不起作用。类似于:viewLocator.useConvention('viewmodels','views','' 但我仍然得到: App/viewmodels/shell.html 404(未找到) 显然,它不应该在app/viewmodels/中查看,它应该在app/views/ 我的项目中的不同之处在于,我没有将“/s

我在尝试激活shell时遇到404错误。它似乎找到了shell.js,但随后表明它找不到shell.html,因为它找错了位置

我试图强迫公约明确地告诉它去哪里看,但它仍然不起作用。类似于:
viewLocator.useConvention('viewmodels','views',''

但我仍然得到:

App/viewmodels/shell.html 404(未找到)

显然,它不应该在
app/viewmodels/
中查看,它应该在
app/views/

我的项目中的不同之处在于,我没有将“/scripts/”文件夹用于第三方内容,而是使用我自己的名为“/content/”的文件夹。我还将几乎所有与durandal有关的内容都放在“/app/”文件夹中

以下是我的项目中一些关键文件的结构:

+app (folder)
  main.js
  > durandal (folder)
     app.js
     r.js
     require.js
     text.js
     viewEngine.js
     viewLocator.js
 > plugins (folder)
     router.js
 > viewmodels (folder)
     shell.js
 > views (folder)
     shell.html
在main.js> 下面是我将shell设置为调用的位置:
app.setRoot('viewmodels/shell')

以下是main.js中的路径:

paths: {
        'text': 'durandal/text',
        'durandal': 'durandal',
        'plugins': 'durandal/plugins',
        'transitions': 'durandal/transitions'
}
在shell.js中> 其实这并不重要,因为此时已经抛出了404


有什么想法吗?

我现在明白了。我在main.js中定义了错误的模块路径。不确定他们为什么没有抛出错误,但无论如何,我改变了以下内容:

发件人:
定义(['../app/durandal/system'、'../app/durandal/app'、'../app/durandal/viewLocator'],函数(系统、应用、viewLocator){

致:
定义(['durandal/system','durandal/app','durandal/viewLocator'],函数(系统,app,viewLocator){


现在似乎可以工作了。

我现在明白了。我在main.js中找到了错误的模块路径。不确定他们为什么没有抛出错误,但无论如何,我更改了以下内容:

发件人:
定义(['../app/durandal/system'、'../app/durandal/app'、'../app/durandal/viewLocator'],函数(系统、应用、viewLocator){

致:
定义(['durandal/system','durandal/app','durandal/viewLocator'],函数(系统,app,viewLocator){


现在似乎可以正常工作。

指向
插件和
文本的路径看起来不正确。如果基本URL是
app
,那么它应该是
'plugins':'plugins'
'text':'text'
。这是个好主意,但它们是正确的。从我上面的图中看有点不清楚,但路径实际上是'app>durandal'和't'下面是“plugins”目录。如果我删除“durandal/”部分,它将找不到文件,并在我已经得到的部分上抛出404错误。指向
插件和
文本的路径看起来不正确。如果baseUrl是
应用程序
,那么它应该是
插件:
文本:'text'。好主意,但它们是正确的。从我上面的图纸上看有点不清楚,但路径实际上是“app>durandal”和它下面的“plugins”目录。如果我删除“durandal/”部分,它将找不到文件,并在我已经得到的文件上抛出404错误。