在IIS 8(Windows 8)上部署ASP.Net MVC应用程序时未呈现CSS和JS文件

NTinkicht

在远程IIS 8上部署Asp.NET MVC 5 Web应用程序时遇到问题!当我启动服务器时,该应用程序运行良好,但是没有CSS或JS文件正在运行!

我的本地机器: 在此处输入图片说明

我的远程机器:

在此处输入图片说明

单击视图页面源(在浏览器中)时的视图:

<!DOCTYPE html>
<html>
 <head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Log in - My MVC Admin Template</title>
    <link href="/Test/Deploy/Content/Theme?v=A1Wwh5B5yTT6Q-34hA0bU7wzaNpIMgCZT8xJ-IAWWVY1" rel="stylesheet"/>

    <script src="/Test/Deploy/bundles/modernizr?v=wBEWDufH_8Md-Pbioxomt90vm6tJN2Pyy9u9zHtWsPo1"></script>


 </head>
<body class="bootstrap-admin-with-small-navbar">
<div class="container">
    <div class="row">
     <div class="row">
       <form action="/Test/Deploy/" class="bootstrap-admin-login-form" method="post"><input name="__RequestVerificationToken" type="hidden" value="C7q6oci5GoiOMjIeCGgn9-U4lMlx54WJz8117lyBbFcbDak6TzJE2z3kKeBkvyJTJxg6viMGh8dOxCUV2qUP87bZBWyXgMsx3g9Tozmxoc41" />        
        <h1>Login</h1>
         <div class="form-group">
            <input class="form-control" type="text" name="Email" placeholder="Email">
             <span class="field-validation-valid text-danger" data-valmsg-for="Email" data-valmsg-replace="true"></span>
             </div>
             <div class="form-group">
        <input class="form-control" type="password" name="Password" placeholder="Password">
        <span class="field-validation-valid text-danger" data-valmsg-for="Password" data-valmsg-replace="true"></span>
    </div>
    <div class="form-group">
        <div>
            <div class="checkbox">
                <input data-val="true" data-val-required="The Remember me? field is required." id="RememberMe" name="RememberMe" type="checkbox" value="true" /><input name="RememberMe" type="hidden" value="false" />
                <label for="RememberMe">Remember me?</label>
            </div>
        </div>
    </div>
    <button class="btn btn-lg btn-primary" type="submit">Submit</button>
  </form>
   </div>
    </div>
    <div class="row">
        <hr>
        <footer role="contentinfo">
            <p>&copy;  2015 -  <a href="" target="_blank">Test</a></p>
        </footer>
    </div>
</div>

<script src="/Test/Deploy/bundles/jquery?v="></script>

<script src="/Test/Deploy/bundles/bootstrap?v=a0JlrK3HWJYO4CANWtnjZQ6r-FHTgFewh3ItuNGmfr41"></script>


<script src="/Test/Deploy/bundles/jqueryval?v=NOVQDySGO89wzMzO5x7mWS4C_uAdynpZe_Lk2y-xEM41"></script>



<script>
    (function (i, s, o, g, r, a, m) {
        i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
            (i[r].q = i[r].q || []).push(arguments)
        }, i[r].l = 1 * new Date(); a = s.createElement(o),
            m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
    })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');

    ga('create', 'UA-45396411-1', 'azurewebsites.net');
    ga('send', 'pageview');

</script>

我的BundleConfig.cs:

    public class BundleConfig
{
    public static void AddDefaultIgnorePatterns(IgnoreList ignoreList)
    {
        if (ignoreList == null)
            throw new ArgumentNullException("ignoreList");
        ignoreList.Ignore("*.intellisense.js");
        ignoreList.Ignore("*-vsdoc.js");
        ignoreList.Ignore("*.debug.js", OptimizationMode.WhenEnabled);
        //ignoreList.Ignore("*.min.js", OptimizationMode.WhenDisabled);
        ignoreList.Ignore("*.min.css", OptimizationMode.WhenDisabled);
    }

    // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
    public static void RegisterBundles(BundleCollection bundles)
    {
        bundles.IgnoreList.Clear();
        AddDefaultIgnorePatterns(bundles.IgnoreList);
        bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
            "~/Scripts/jquery-{version}.js"));

        bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
            "~/Scripts/jquery.validate*"));

        // Use the development version of Modernizr to develop with and learn from. Then, when you're
        // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
        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/bootstrap.css",
            "~/Content/site.css"));

        bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
            "~/Scripts/jquery-{version}.js"));

        bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
            "~/Scripts/jquery-ui-{version}.js"));

        bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
            "~/Scripts/jquery.unobtrusive*",
            "~/Scripts/jquery.validate*"));

        // Use the development version of Modernizr to develop with and learn from. Then, when you're
        // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
        bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
            "~/Scripts/modernizr-*"));

        bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
            "~/Scripts/bootstrap.js"
            , "~/Scripts/twitter-bootstrap-hover-dropdown.js"
            ));

        bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));

        bundles.Add(new StyleBundle("~/Content/Theme/base/css").Include(
            "~/Content/Theme/base/jquery.ui.core.css",
            "~/Content/Theme/base/jquery.ui.resizable.css",
            "~/Content/Theme/base/jquery.ui.selectable.css",
            "~/Content/Theme/base/jquery.ui.accordion.css",
            "~/Content/Theme/base/jquery.ui.autocomplete.css",
            "~/Content/Theme/base/jquery.ui.button.css",
            "~/Content/Theme/base/jquery.ui.dialog.css",
            "~/Content/Theme/base/jquery.ui.slider.css",
            "~/Content/Theme/base/jquery.ui.tabs.css",
            "~/Content/Theme/base/jquery.ui.datepicker.css",
            "~/Content/Theme/base/jquery.ui.progressbar.css",
            "~/Content/Theme/base/jquery.ui.theme.css"));

        //Calendar css file
        bundles.Add(new StyleBundle("~/Content/fullcalendarcss").Include(
            "~/Content/themes/jquery.ui.all.css",
            "~/Content/fullcalendar.css"));

        //Calendar Script file
        bundles.Add(new ScriptBundle("~/bundles/fullcalendarjs").Include(
            "~/Scripts/jquery-ui-1.10.4.min.js",
            "~/Scripts/fullcalendar.min.js"));

        bundles.Add(new ScriptBundle("~/bundles/vendors").Include(
            "~/Content/Theme/vendors/uniform/jquery.uniform.js"
            , "~/Content/Theme/vendors/chosen.jquery.js"
            , "~/Content/Theme/vendors/bootstrap-datepicker/js/bootstrap-datepicker.js"
            ,
            "~/Content/Theme/vendors/bootstrap-wysihtml5-rails-b3/vendor/assets/javascripts/bootstrap-wysihtml5/wysihtml5.js"
            ,
            "~/Content/Theme/vendors/bootstrap-wysihtml5-rails-b3/vendor/assets/javascripts/bootstrap-wysihtml5/core-b3.js"
            , "~/Content/Theme/vendors/twitter-bootstrap-wizard/jquery.bootstrap.wizard-for.bootstrap3.js"
            , "~/Content/Theme/vendors/boostrap3-typeahead/bootstrap3-typeahead.js"
            , "~/Content/Theme/vendors/easypiechart/jquery.easy-pie-chart.js"
            , "~/Content/Theme/vendors/ckeditor/ckeditor.js"
            , "~/Content/Theme/vendors/tinymce/js/tinymce/tinymce.js"
            ,
            "~/Content/Theme/vendors/bootstrap-wysihtml5-rails-b3/vendor/assets/javascripts/bootstrap-wysihtml5/wysihtml5.js"
            ,
            "~/Content/Theme/vendors/bootstrap-wysihtml5-rails-b3/vendor/assets/javascripts/bootstrap-wysihtml5/core-b3.js"
            , "~/Content/Theme/vendors/jGrowl/jquery.jgrowl.js"
            , "~/Content/Theme/vendors/bootstrap-datepicker/js/bootstrap-datepicker.js"
            , "~/Content/Theme/vendors/sparkline/jquery.sparkline.js"
            , "~/Content/Theme/vendors/tablesorter/js/jquery.tablesorter.js"
            , "~/Content/Theme/vendors/flot/jquery.flot.js"
            , "~/Content/Theme/vendors/flot/jquery.flot.selection.js"
            , "~/Content/Theme/vendors/flot/jquery.flot.resize.js"
            , "~/Content/Theme/vendors/fullcalendar/fullcalendar.js"
            ));

        bundles.Add(new StyleBundle("~/Content/Theme").Include(
            "~/Content/bootstrap.css",
            "~/Content/bootstrap-theme.css",
            "~/Content/Theme/css/bootstrap-admin-theme.css",
            "~/Content/Theme/css/site.css"));

        bundles.Add(new StyleBundle("~/Content/Vendors").Include(
            "~/Content/Theme/vendors/bootstrap-datepicker/css/datepicker.css"
            , "~/Content/Theme/css/datepicker.fixes.css"
            , "~/Content/Theme/vendors/uniform/themes/default/css/uniform.default.min.css"
            , "~/Content/Theme/css/uniform.default.fixes.css"
            , "~/Content/Theme/vendors/chosen.min.css"
            ,
            "~/Content/Theme/vendors/bootstrap-wysihtml5-rails-b3/vendor/assets/stylesheets/bootstrap-wysihtml5/core-b3.css"
            , "~/Content/Theme/vendors/easypiechart/jquery.easy-pie-chart.css"
            , "~/Content/Theme/vendors/easypiechart/jquery.easy-pie-chart_custom.css"
            ,
            "~/Content/Theme/vendors/bootstrap-wysihtml5-rails-b3/vendor/assets/stylesheets/bootstrap-wysihtml5/core-b3.css"
            , "~/Content/Theme/vendors/jGrowl/jquery.jgrowl.css"
            , "~/Content/Theme/vendors/bootstrap-datepicker/css/datepicker.css"
            , "~/Content/Theme/vendors/fullcalendar/fullcalendar.css"));
    }
}

我的登录页面:

@model LoginViewModel
@{
  ViewBag.Title = "Log in";
 }

 <div class="row">
     @using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "bootstrap-admin-login-form" }))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <h1>Login</h1>
    <div class="form-group">
        <input class="form-control" type="text" name="Email" placeholder="Email">
        @Html.ValidationMessageFor(m => m.Email, "", new { @class = "text-danger" })
    </div>
    <div class="form-group">
        <input class="form-control" type="password" name="Password" placeholder="Password">
        @Html.ValidationMessageFor(m => m.Password, "", new { @class = "text-danger" })
    </div>
    <div class="form-group">
        <div>
            <div class="checkbox">
                @Html.CheckBoxFor(m => m.RememberMe)
                @Html.LabelFor(m => m.RememberMe)
            </div>
        </div>
    </div>
    <button class="btn btn-lg btn-primary" type="submit">Submit</button>
}
</div>
@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
 }

在我的Web.Config文件中,我这样:

 <system.webServer>
   <modules runAllManagedModulesForAllRequests="true">
     <remove name="BundleModule" />
     <add name="BundleModule" type="System.Web.Optimization.BundleModule" />
     <remove name="FormsAuthentication" />
     <remove name="ApplicationInsightsWebTracking" />
     <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Extensibility.Web.RequestTracking.WebRequestTrackingModule, Microsoft.ApplicationInsights.Extensibility.Web" preCondition="managedHandler" />
   </modules>
   <validation validateIntegratedModeConfiguration="false" />
 </system.webServer>

我在网络上看到了很多解决方案,包括服务器端和项目端!在Windows功能中启用了静态内容按照此处的指示更改了BundleConfig.cs文件。Bundler不包括.min文件,但对我没有任何帮助!

注意:我的其中一个页面在razor文件中定义了一些样式,呈现效果很好!所以我认为问题出在捆绑文件内!

有人可以帮我吗?

<====编辑=====>

我只是放入了Web.Config文件:

  <compilation debug="false" targetFramework="4.5" />

如果我的本地计算机可以帮助某人理解,那么结果就是没有样式(就像远程计算机一样)。

NTinkicht

我解决了问题!

由于捆绑和缩小不使用Asp.net 4.0 C#应用CSS和js

我所要做的就是在我的bundleConfig.cs文件中将名称更改为:

  bundles.Add(new StyleBundle("~/Content/Theme").Include(
            "~/Content/bootstrap.css",
            "~/Content/bootstrap-theme.css",
            "~/Content/Theme/css/bootstrap-admin-theme.css",
            "~/Content/Theme/css/site.css"));

  bundles.Add(new StyleBundle("~/Content/allcss").Include(
            "~/Content/bootstrap.css",
            "~/Content/bootstrap-theme.css",
            "~/Content/Theme/style/bootstrap-admin-theme.css",
            "~/Content/Theme/style/site.css"));

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

将ASP.NET MVC网站部署到IIS 8

来自分类Dev

在IIS 7上部署ASP.Net MVC 4 App

来自分类Dev

如何将ASP.Net MVC 5部署到IIS 8 Windows Server 2012?

来自分类Dev

使用IIS 8在Windows Server 2012上托管asp.net应用程序时,CSS,Javascript或Jquery无法正常工作

来自分类Dev

在IIS Express或其他WebServer上部署ASP.NET MVC App?

来自分类Dev

在 IIS-10 上部署平面 angular-2 应用程序(无 asp.net core)

来自分类Dev

是否可以将ASP.NET MVC 5应用程序部署到Windows Server 2003 IIS 6

来自分类Dev

如何在Windows 7上使用localDB将ASP.NET MVC 4应用程序部署到本地IIS?

来自分类Dev

MVC5 ASP.net Identity 2.0用户管理,并从localDB部署到IIS服务器8

来自分类Dev

将ASP.NET 5 MVC 6应用程序部署到Linux和IIS 7

来自分类Dev

如何使用Windows Server 2008 R2和IIS 7.5部署ASP NET MVC 4 Web应用程序?

来自分类Dev

将MVC4应用程序部署到IIS 8后,无法加载图像并且未引用CSS

来自分类Dev

IIS部署asp.net应用程序

来自分类Dev

IIS中的Asp.Net核心MVC应用程序Windows身份验证

来自分类Dev

IIS 8中的.Net Core和Windows身份验证失败

来自分类Dev

IIS 8和Windows身份验证

来自分类Dev

如何检查IIS内部署的asp.net mvc Web应用程序的日志

来自分类Dev

如何检查IIS内部署的asp.net mvc Web应用程序的日志

来自分类Dev

在 IIS 上发布 ASP.NET MVC 应用程序

来自分类Dev

在IIS上部署PHP应用程序

来自分类Dev

如何在Windows PC(Windows 7 / Windows 8)上部署Rails应用程序?

来自分类Dev

在 SharePoint Online 上部署 ASP.NET 应用程序

来自分类Dev

部署angular 8和asp.net core 3.1的步骤

来自分类Dev

在IIS上部署React JS

来自分类Dev

在IIS 8.5和Windows Server 2012 R2上运行的ASP.NET应用程序的默认GC模式

来自分类Dev

如何使用WebListener和Windows身份验证将ASP.NET Core应用程序托管在IIS下?

来自分类Dev

如何使用WebListener和Windows身份验证将ASP.NET Core应用程序托管在IIS下?

来自分类Dev

保护本地IIS8上的Asp.Net MVC 4

来自分类Dev

在Firebase上部署Angular 8 Universal(SSR)应用程序

Related 相关文章

  1. 1

    将ASP.NET MVC网站部署到IIS 8

  2. 2

    在IIS 7上部署ASP.Net MVC 4 App

  3. 3

    如何将ASP.Net MVC 5部署到IIS 8 Windows Server 2012?

  4. 4

    使用IIS 8在Windows Server 2012上托管asp.net应用程序时,CSS,Javascript或Jquery无法正常工作

  5. 5

    在IIS Express或其他WebServer上部署ASP.NET MVC App?

  6. 6

    在 IIS-10 上部署平面 angular-2 应用程序(无 asp.net core)

  7. 7

    是否可以将ASP.NET MVC 5应用程序部署到Windows Server 2003 IIS 6

  8. 8

    如何在Windows 7上使用localDB将ASP.NET MVC 4应用程序部署到本地IIS?

  9. 9

    MVC5 ASP.net Identity 2.0用户管理,并从localDB部署到IIS服务器8

  10. 10

    将ASP.NET 5 MVC 6应用程序部署到Linux和IIS 7

  11. 11

    如何使用Windows Server 2008 R2和IIS 7.5部署ASP NET MVC 4 Web应用程序?

  12. 12

    将MVC4应用程序部署到IIS 8后,无法加载图像并且未引用CSS

  13. 13

    IIS部署asp.net应用程序

  14. 14

    IIS中的Asp.Net核心MVC应用程序Windows身份验证

  15. 15

    IIS 8中的.Net Core和Windows身份验证失败

  16. 16

    IIS 8和Windows身份验证

  17. 17

    如何检查IIS内部署的asp.net mvc Web应用程序的日志

  18. 18

    如何检查IIS内部署的asp.net mvc Web应用程序的日志

  19. 19

    在 IIS 上发布 ASP.NET MVC 应用程序

  20. 20

    在IIS上部署PHP应用程序

  21. 21

    如何在Windows PC(Windows 7 / Windows 8)上部署Rails应用程序?

  22. 22

    在 SharePoint Online 上部署 ASP.NET 应用程序

  23. 23

    部署angular 8和asp.net core 3.1的步骤

  24. 24

    在IIS上部署React JS

  25. 25

    在IIS 8.5和Windows Server 2012 R2上运行的ASP.NET应用程序的默认GC模式

  26. 26

    如何使用WebListener和Windows身份验证将ASP.NET Core应用程序托管在IIS下?

  27. 27

    如何使用WebListener和Windows身份验证将ASP.NET Core应用程序托管在IIS下?

  28. 28

    保护本地IIS8上的Asp.Net MVC 4

  29. 29

    在Firebase上部署Angular 8 Universal(SSR)应用程序

热门标签

归档