2016-11-07 122 views
1

UPDATE

我發現問題的根源,但我仍然無法弄清楚。一切正確加載,如果該網站是http://mysite/vd1/vd2/而不是http://mysite/vd1/vd2(正確的有結尾的斜線)Aurelia與虛擬目錄捆綁問題

原始

我試圖發表我的第一aspnetcore Aurelia路上,應用到IIS虛擬目錄http://mysite/vd1/vd2其中VD2(虛擬目錄2)是aurelia-app的主頁。但是,當瀏覽器試圖加載第一個包,aurelia.js,它正在尋找http://mysite/vd1/dist而不是vd2,它返回一個404。我試圖讓路徑相對,但也許我失去了一些東西?任何幫助表示讚賞,並請讓我知道是否需要更多信息,因爲我有問題追查問題。

Index.cshtml
<div aurelia-app="main"> 
    <div class="splash"> 
    <div class="message">@ViewBag.AppTitle</div> 
    <div class="fa fa-spinner fa-pulse fa-fw"></div> 
    </div> 

    <environment names="Development"> 
    <script src="~/jspm_packages/npm/[email protected]/js/browser/bluebird.js"></script> 
    </environment> 
    <environment names="Staging,Production"> 
    <script src="~/jspm_packages/npm/[email protected]/js/browser/bluebird.min.js"></script> 
    </environment> 

    <script src="~/jspm_packages/system.js"></script> 

    <script src="~/config.js"></script> 

    <script> 
    System.import("aurelia-bootstrapper"); 
    </script> 
</div> 

bundle.js
var gulp = require('gulp'); 
var bundler = require('aurelia-bundler'); 
var bundles = require('../bundles.js'); 

var config = { 
    force: true, 
    baseURL: './wwwroot', 
    configPath: './wwwroot/config.js', 
    bundles: bundles.bundles 
}; 

gulp.task('bundle', ['build'], function() { 
    return bundler.bundle(config); 
}); 

gulp.task('unbundle', function() { 
    return bundler.unbundle(config); 
}); 

bundles.js
module.exports = { 
    "bundles": { 
    "dist/app-build": { 
     "includes": [ 
     "[**/*.js]", 
     "**/*.html!text", 
     "**/*.css!text" 
     ], 
     "options": { 
     "inject": true, 
     "minify": true, 
     "depCache": true, 
     "rev": false 
     } 
    }, 
    "dist/aurelia": { 
     "includes": [ 
     "aurelia-framework", 
     "aurelia-bootstrapper", 
     "aurelia-fetch-client", 
     "aurelia-router", 
     "aurelia-animator-css", 
     "aurelia-dialog", 
     "aurelia-event-aggregator", 
     "aurelia-templating-binding", 
     "aurelia-polyfills", 
     "aurelia-templating-resources", 
     "aurelia-templating-router", 
     "aurelia-loader-default", 
     "aurelia-history-browser", 
     "aurelia-logging-console", 
     "aurelia-pal-browser", 
     "aurelia-validation", 
     "bootstrap", 
     "bootstrap/css/bootstrap.min.css!text", 
     "fetch", 
     "jquery", 
     "moment", 
     "jquery-ui", 
     "keymirror", 
     "toastr" 
     ], 
     "options": { 
     "inject": true, 
     "minify": true, 
     "depCache": false, 
     "rev": false 
     } 
    } 
    } 
}; 

config.js
System.config({ 
    defaultJSExtensions: true, 
    transpiler: false, 
    paths: { 
    "*": "dist/*", 
    "github:*": "jspm_packages/github/*", 
    "npm:*": "jspm_packages/npm/*" 
    }, 
    map: { 
    "aurelia-animator-css": "npm:[email protected]", 
    "aurelia-bootstrapper": "npm:[email protected]", 
    "aurelia-dialog": "npm:[email protected]", 
    "aurelia-event-aggregator": "npm:[email protected]", 
    "aurelia-fetch-client": "npm:[email protected]", 
    ... 
    }, 
    bundles: { 
    "aurelia.js": [ 
     "github:CodeSeven/[email protected]", 
     "github:CodeSeven/[email protected]/build/toastr.css!github:systemjs/[email protected]", 
     "github:CodeSeven/[email protected]/toastr.js", 
     "github:components/[email protected]", 
     "github:components/[email protected]/jquery.js", 
     "github:components/[email protected]", 
     "github:components/[email protected]/jquery-ui.js", 
     "github:github/[email protected]", 
     "github:github/[email protected]/fetch.js", 
     "github:twbs/[email protected]", 
     "github:twbs/[email protected]/css/bootstrap.min.css!github:systemjs/[email protected]", 
     "github:twbs/[email protected]/js/bootstrap.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-animator-css.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-binding.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-bootstrapper.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-dependency-injection.js", 
     "npm:[email protected]", 
     "npm:[email protected]/ai-dialog-body.js", 
     "npm:[email protected]/ai-dialog-footer.js", 
     "npm:[email protected]/ai-dialog-header.js", 
     "npm:[email protected]/ai-dialog.js", 
     "npm:[email protected]/attach-focus.js", 
     "npm:[email protected]/aurelia-dialog.js", 
     "npm:[email protected]/dialog-configuration.js", 
     "npm:[email protected]/dialog-controller.js", 
     "npm:[email protected]/dialog-options.js", 
     "npm:[email protected]/dialog-renderer.js", 
     "npm:[email protected]/dialog-result.js", 
     "npm:[email protected]/dialog-service.js", 
     "npm:[email protected]/lifecycle.js", 
     "npm:[email protected]/renderer.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-event-aggregator.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-fetch-client.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-framework.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-history-browser.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-history.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-loader-default.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-loader.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-logging-console.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-logging.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-metadata.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-pal-browser.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-pal.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-path.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-polyfills.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-route-recognizer.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-router.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-task-queue.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-templating-binding.js", 
     "npm:[email protected]", 
     "npm:[email protected]/abstract-repeater.js", 
     "npm:[email protected]/analyze-view-factory.js", 
     "npm:[email protected]/array-repeat-strategy.js", 
     "npm:[email protected]/aurelia-hide-style.js", 
     "npm:[email protected]/aurelia-templating-resources.js", 
     "npm:[email protected]/binding-mode-behaviors.js", 
     "npm:[email protected]/binding-signaler.js", 
     "npm:[email protected]/compose.js", 
     "npm:[email protected]/css-resource.js", 
     "npm:[email protected]/debounce-binding-behavior.js", 
     "npm:[email protected]/dynamic-element.js", 
     "npm:[email protected]/focus.js", 
     "npm:[email protected]/hide.js", 
     "npm:[email protected]/html-resource-plugin.js", 
     "npm:[email protected]/html-sanitizer.js", 
     "npm:[email protected]/if.js", 
     "npm:[email protected]/map-repeat-strategy.js", 
     "npm:[email protected]/null-repeat-strategy.js", 
     "npm:[email protected]/number-repeat-strategy.js", 
     "npm:[email protected]/repeat-strategy-locator.js", 
     "npm:[email protected]/repeat-utilities.js", 
     "npm:[email protected]/repeat.js", 
     "npm:[email protected]/replaceable.js", 
     "npm:[email protected]/sanitize-html.js", 
     "npm:[email protected]/set-repeat-strategy.js", 
     "npm:[email protected]/show.js", 
     "npm:[email protected]/signal-binding-behavior.js", 
     "npm:[email protected]/throttle-binding-behavior.js", 
     "npm:[email protected]/update-trigger-binding-behavior.js", 
     "npm:[email protected]/with.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-templating-router.js", 
     "npm:[email protected]/route-href.js", 
     "npm:[email protected]/route-loader.js", 
     "npm:[email protected]/router-view.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-templating.js", 
     "npm:[email protected]", 
     "npm:[email protected]/aurelia-validation.js", 
     "npm:[email protected]/implementation/rules.js", 
     "npm:[email protected]/implementation/standard-validator.js", 
     "npm:[email protected]/implementation/util.js", 
     "npm:[email protected]/implementation/validation-messages.js", 
     "npm:[email protected]/implementation/validation-parser.js", 
     "npm:[email protected]/implementation/validation-rules.js", 
     "npm:[email protected]/property-info.js", 
     "npm:[email protected]/validate-binding-behavior-base.js", 
     "npm:[email protected]/validate-binding-behavior.js", 
     "npm:[email protected]/validate-trigger.js", 
     "npm:[email protected]/validation-controller-factory.js", 
     "npm:[email protected]/validation-controller.js", 
     "npm:[email protected]/validation-error.js", 
     "npm:[email protected]/validation-errors-custom-attribute.js", 
     "npm:[email protected]/validation-renderer-custom-attribute.js", 
     "npm:[email protected]/validator.js", 
     "npm:[email protected]", 
     "npm:[email protected]/dist/jquery.js", 
     "npm:[email protected]", 
     "npm:[email protected]/index.js", 
     "npm:[email protected]", 
     "npm:[email protected]/moment.js" 
    ], 
    "app-build.js": [ 
     "app.html!github:systemjs/[email protected]", 
     "app.js", 
     "assignments/assignment-store.js", 
     "assignments/handler-list.html!github:systemjs/[email protected]", 
     "assignments/handler-list.js", 
     "assignments/notes.html!github:systemjs/[email protected]", 
     "assignments/notes.js", 
     "assignments/priority-flags.html!github:systemjs/[email protected]", 
     "assignments/priority-flags.js", 
     "configuration/http-client.js", 
     "configuration/router.js", 
     "configuration/toastr.js", 
     "constants.js", 
     "core/attachment-service.js", 
     "core/http-interceptors.js", 
     "core/logger.js", 
     "core/resource-store.js", 
     "core/store.js", 
     "main.js", 
     "register.js", 
     "registration.html!github:systemjs/[email protected]", 
     "registration.js", 
     "requests/comment-store.js", 
     "requests/comments.html!github:systemjs/[email protected]", 
     "requests/comments.js", 
     "requests/new-request.html!github:systemjs/[email protected]", 
     "requests/new-request.js", 
     "requests/request-detail.html!github:systemjs/[email protected]", 
     "requests/request-detail.js", 
     "requests/request-list.html!github:systemjs/[email protected]", 
     "requests/request-list.js", 
     "requests/request-store.js", 
     "requests/request.html!github:systemjs/[email protected]", 
     "requests/request.js", 
     "requests/status-list.html!github:systemjs/[email protected]", 
     "requests/status-list.js", 
     "requests/view-list.html!github:systemjs/[email protected]", 
     "requests/view-list.js", 
     "resources/dialogs/validation-list.html!github:systemjs/[email protected]", 
     "resources/dialogs/validation-list.js", 
     "resources/elements/attachments.html!github:systemjs/[email protected]", 
     "resources/elements/badge-list.html!github:systemjs/[email protected]", 
     "resources/elements/badge-list.js", 
     "resources/elements/color-flag.html!github:systemjs/[email protected]", 
     "resources/elements/color-flag.js", 
     "resources/elements/date-picker.html!github:systemjs/[email protected]", 
     "resources/elements/date-picker.js", 
     "resources/elements/drop-menu.html!github:systemjs/[email protected]", 
     "resources/elements/menu-button.html!github:systemjs/[email protected]", 
     "resources/elements/menu-button.js", 
     "resources/elements/progress-bar.html!github:systemjs/[email protected]", 
     "resources/elements/progress-bar.js", 
     "resources/index.js", 
     "resources/value-converters/date-format.js", 
     "resources/value-converters/groupBy.js", 
     "resources/value-converters/sort.js", 
     "settings/app-level/app-settings.html!github:systemjs/[email protected]", 
     "settings/app-level/app-settings.js", 
     "settings/app-level/handlers.html!github:systemjs/[email protected]", 
     "settings/app-level/handlers.js", 
     "settings/app-level/new-handler.html!github:systemjs/[email protected]", 
     "settings/app-level/new-handler.js", 
     "settings/global-settings.html!github:systemjs/[email protected]", 
     "settings/index.js", 
     "settings/member-level/member-settings.html!github:systemjs/[email protected]", 
     "settings/member-level/member-settings.js", 
     "settings/member-settings.html!github:systemjs/[email protected]", 
     "settings/member-store.js", 
     "settings/settings-store.js", 
     "shell/handler-menu.html!github:systemjs/[email protected]", 
     "shell/handler-menu.js", 
     "shell/nav-bar.html!github:systemjs/[email protected]", 
     "shell/request-menu.html!github:systemjs/[email protected]", 
     "shell/request-menu.js", 
     "shell/search-bar-service.js", 
     "shell/search-bar.html!github:systemjs/[email protected]", 
     "shell/search-bar.js", 
     "shell/settings-menu.html!github:systemjs/[email protected]", 
     "shell/settings-menu.js", 
     "utils.js" 
    ] 
    }, 
    depCache: { 
    "app.js": [ 
     "./configuration/http-client", 
     "./configuration/router", 
     "aurelia-framework", 
     "aurelia-event-aggregator", 
     "aurelia-router" 
    ], 
    "assignments/assignment-store.js": [ 
     "aurelia-framework", 
     "../core/resource-store" 
    ], 
    "assignments/handler-list.js": [ 
     "../settings/member-store", 
     "aurelia-framework" 
    ], 
    "assignments/notes.js": [ 
     "../settings/member-store", 
     "./assignment-store", 
     "aurelia-framework", 
     "jquery" 
    ], 
    "assignments/priority-flags.js": [ 
     "../settings/settings-store", 
     "aurelia-framework" 
    ], 
    "configuration/http-client.js": [ 
     "aurelia-fetch-client", 
     "aurelia-framework" 
    ], 
    "configuration/router.js": [ 
     "../settings/settings-store", 
     "aurelia-framework", 
     "aurelia-router" 
    ], 
    "configuration/toastr.js": [ 
     "toastr" 
    ], 
    "constants.js": [ 
     "keymirror" 
    ], 
    "core/http-interceptors.js": [ 
     "aurelia-validation", 
     "../core/logger", 
     "aurelia-framework" 
    ], 
    "core/logger.js": [ 
     "toastr" 
    ], 
    "core/resource-store.js": [ 
     "aurelia-fetch-client", 
     "aurelia-framework", 
     "fetch" 
    ], 
    "core/store.js": [ 
     "aurelia-event-aggregator", 
     "aurelia-framework" 
    ], 
    "main.js": [ 
     "./core/http-interceptors", 
     "aurelia-framework", 
     "./core/logger.js", 
     "bootstrap", 
     "./configuration/toastr" 
    ], 
    "register.js": [ 
     "./core/http-interceptors", 
     "bootstrap", 
     "./configuration/toastr" 
    ], 
    "registration.js": [ 
     "aurelia-framework", 
     "aurelia-event-aggregator", 
     "./constants", 
     "./configuration/http-client", 
     "./settings/settings-store", 
     "aurelia-pal" 
    ], 
    "requests/comment-store.js": [ 
     "../core/logger", 
     "../core/resource-store", 
     "aurelia-fetch-client", 
     "aurelia-framework" 
    ], 
    "requests/comments.js": [ 
     "./comment-store", 
     "../settings/member-store", 
     "aurelia-framework" 
    ], 
    "requests/new-request.js": [ 
     "aurelia-dialog", 
     "./request-store", 
     "aurelia-framework", 
     "aurelia-validation" 
    ], 
    "requests/request-detail.js": [ 
     "jquery", 
     "./request-store", 
     "aurelia-framework" 
    ], 
    "requests/request-list.js": [ 
     "./request-store", 
     "../shell/search-bar-service", 
     "../resources/dialogs/validation-list", 
     "aurelia-framework", 
     "aurelia-validation", 
     "aurelia-dialog", 
     "aurelia-event-aggregator", 
     "../constants" 
    ], 
    "requests/request-store.js": [ 
     "aurelia-framework", 
     "../core/resource-store", 
     "../core/attachment-service", 
     "aurelia-fetch-client", 
     "../core/logger", 
     "aurelia-event-aggregator", 
     "../core/store", 
     "../constants" 
    ], 
    "requests/request.js": [ 
     "aurelia-framework", 
     "moment" 
    ], 
    "requests/status-list.js": [ 
     "../settings/settings-store", 
     "../settings/member-store", 
     "aurelia-framework" 
    ], 
    "requests/view-list.js": [ 
     "shell/search-bar-service", 
     "../settings/member-store", 
     "aurelia-framework" 
    ], 
    "resources/dialogs/validation-list.js": [ 
     "aurelia-dialog", 
     "aurelia-framework", 
     "aurelia-validation" 
    ], 
    "resources/elements/badge-list.js": [ 
     "aurelia-framework" 
    ], 
    "resources/elements/color-flag.js": [ 
     "aurelia-framework" 
    ], 
    "resources/elements/date-picker.js": [ 
     "jquery", 
     "moment", 
     "aurelia-framework", 
     "jquery-ui" 
    ], 
    "resources/elements/menu-button.js": [ 
     "aurelia-framework" 
    ], 
    "resources/elements/progress-bar.js": [ 
     "aurelia-framework" 
    ], 
    "resources/value-converters/date-format.js": [ 
     "moment" 
    ], 
    "resources/value-converters/sort.js": [ 
     "../../utils.js", 
     "moment" 
    ], 
    "settings/app-level/app-settings.js": [ 
     "aurelia-framework", 
     "aurelia-event-aggregator", 
     "../../constants", 
     "../settings-store" 
    ], 
    "settings/app-level/handlers.js": [ 
     "../member-store", 
     "aurelia-framework" 
    ], 
    "settings/app-level/new-handler.js": [ 
     "aurelia-dialog", 
     "../member-store", 
     "aurelia-framework", 
     "aurelia-validation" 
    ], 
    "settings/index.js": [ 
     "./member-store", 
     "aurelia-framework" 
    ], 
    "settings/member-level/member-settings.js": [ 
     "aurelia-framework", 
     "../member-store" 
    ], 
    "settings/member-store.js": [ 
     "aurelia-fetch-client", 
     "aurelia-framework", 
     "../core/logger", 
     "../core/resource-store", 
     "../core/store", 
     "../constants", 
     "aurelia-event-aggregator" 
    ], 
    "settings/settings-store.js": [ 
     "../core/resource-store", 
     "aurelia-framework", 
     "aurelia-fetch-client", 
     "../core/logger", 
     "aurelia-event-aggregator", 
     "../core/store", 
     "../constants" 
    ], 
    "shell/handler-menu.js": [ 
     "aurelia-dialog", 
     "../settings/app-level/new-handler", 
     "../settings/member-store", 
     "aurelia-framework" 
    ], 
    "shell/request-menu.js": [ 
     "aurelia-dialog", 
     "../requests/new-request", 
     "aurelia-framework" 
    ], 
    "shell/search-bar.js": [ 
     "shell/search-bar-service", 
     "aurelia-framework" 
    ], 
    "shell/settings-menu.js": [ 
     "../settings/member-store", 
     "../settings/settings-store", 
     "aurelia-framework" 
    ], 
    "utils.js": [ 
     "moment" 
    ] 
    } 
}); 
+0

瘋狂猜測,當您在jspm配置中將'「*」:「dist/*」'改爲'「*」:「./dist/*」時會發生什麼? (添加./到遠程路徑) –

+0

我嘗試了幾個小時前,沒有運氣(它試圖加載http://mysite/v1/dist/dist/aurelia.js)。但是我知道它必須是我的文件之一,現在我知道斜線是問題。 –

+0

嗯,當你添加到HTML 的頭部會有什麼區別? –

回答

1

很好,我很高興它的作品!

只是爲別人有同樣的問題特徵基準中:

嘗試添加該到HTML <base href="/vd1/vd2/">的頭部,將解決這個問題。

或者添加<base href="@Url.Content("~/")" />_Layout.cshtml讓asp.net爲你生成這個路徑。