2017-07-06 78 views
2

爲什麼當web.config中的調試標誌設置爲true時會出現以下錯誤?導致HTTPS錯誤的ASP.Net綁定

混合內容:在 'https://example.com/' 加載頁面上 HTTPS,但要求一個不安全的腳本 'http://example.com/scripts/base/?v=JeAlpXPCZh9gYv4U-X7_HSaAX3Fj3sGBjwukxEaloQU1'。

捆綁

bundles.Add(new ScriptBundle("~/scripts/base").Include(
    "~/Scripts/Base/app.module.js", 
    "~/Scripts/Home/home.controller.js", 
    "~/Scripts/Home/about.controller.js", 
    "~/Scripts/App/Common/dictionary.class.js", 
    "~/Scripts/App/Common/constants.class.js", 
    "~/Scripts/App/Common/multiselect.directive.js", 
    "~/Scripts/App/Common/paginationOptions.class.js", 
    "~/Scripts/App/Common/gridHeight.directive.js", 
    "~/Scripts/App/Common/utility.service.js", 
    "~/Scripts/App/Common/dateToString.directive.js", 
    "~/Scripts/App/Common/base.controller.js", 
    "~/Scripts/App/Common/messagePopover.controller.js" 
)); 

生成的HTML

<script src="/scripts/base?v=JeAlpXPCZh9gYv4U-X7_HSaAX3Fj3sGBjwukxEaloQU1"></script> 

回答

1

我今天早上也有類似的問題。我發現我設置的虛擬路徑與包含腳本的文件夾結構相同,一旦我重命名了虛擬文件夾路徑,就會通過https請求腳本包。

嘗試更改腳本包虛擬路徑爲;

bundles.Add(new ScriptBundle("~/scripts/applicationBase").Include(
"~/Scripts/Base/app.module.js", 
...., 
.... 
)); 

希望幫助

+0

我加'/ virtual'我包的虛擬路徑,它似乎工作。謝謝! – Homer