從Azure中的Visual Studio 2015發佈我的應用程序時,出現此問題;它看起來是這樣的:從Visual Studio 2015在Azure中發佈應用程序不會加載.CSS
顯然它沒有正確加載.css文件(和誰知道還有什麼)。
我做了很多調查,但與我的預期相反,很難找到問題的根源,但在一些丟失的論壇中,我發現web.config在發佈時獲取其屬性,我的當地web.config文件看起來是這樣的:
<system.web>
<authentication mode="None" />
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
</httpModules>
我的遙控web.config中像這樣:
<system.web>
<authentication mode="None" />
<compilation targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
</httpModules>
當我加入調試=「真」,在編譯一切正常:
我想離開這裏這幫助別人有同樣的問題,並順便我的問題:
1-爲什麼禁用調試會影響.css文件(以及其他文件)的加載方式?
2-有沒有另一種方法來糾正這一點,而不允許在我的遠程服務器上調試?
3-也許還有另一種解決方法,我錯過了我的幫助搜索,如果有人以前遇到過這個問題,請分享您的知識。
人們可以預料,這將是很常見的,畢竟我只是發表在蔚藍的xD
一個應用程序可能是重要的一提的是我的應用程序也可以與數據的基礎上,現在我會嘗試學習如何在azure xD上執行該操作
謝謝!
編輯: BundleConfig.cs
using System.Web;
using System.Web.Optimization;
namespace Distribuidora_Saturno
{
public class BundleConfig
{
// Para obtener más información sobre Bundles, visite http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
// Utilice la versión de desarrollo de Modernizr para desarrollar y obtener información. De este modo, estará
// preparado para la producción y podrá utilizar la herramienta de compilación disponible en http://modernizr.com para seleccionar solo las pruebas que necesite.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));
bundles.Add(new StyleBundle("~/Content/CSS").Include(
"~/Content/CSS/bootstrap.css",
"~/Content/CSS/site.css"));
}
}
}
你可以分享你的應用程序的實際URL?看來捆綁正在搞亂你的CSS路徑。通常出現這種情況有圖標(http://stackoverflow.com/questions/19664287/bootstrap-icons-are-loaded-locally-but-not-when-online),但它可能是值得考慮的一個頁面加載的實際響應在您的實際網站上。 –
當然,你可以通過訪問http://distribuidorasaturno.azurewebsites.net/ 正如我所說的,它現在的工作,但只有在遠程服務器上啓用調試完畢後,我不知道爲什麼! – Loaderon
您可以在禁用調試的情況下部署代碼嗎? –