2

I publish my MVC website in IIS 7 in the server. When i check the page source, i see is not rendered correctly like in my laptop.

Here are the page source after publish in IIS server:

<title>Index - abc System</title>
<link href="/Content/css?v=_rLk6cMaTu8NrnGsCcMX7zjA8m5GS5kIRuTA39lx1hA1" rel="stylesheet"/>

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

<script src="/bundles/jquery?v=FVs3ACwOLIVInrAl5sdzR2jrCDmVOWFbZMY6g6Q0ulE1"></script>

<script src="/bundles/bootstrap?v=Powlo484qpYf7E94XNxyY8F7N2GFx0uTQqXYUc9P62E1"></script>

<script src="/bundles/jqueryui?v=ZtBSbUDKlnEJoTEt91W1Sw3Wm7_cMVUFkutTVjnNqLk1"></script>


<!-- Script for menu -->
<script src="/Scripts/jqsimplemenu.js" type="text/javascript"></script>

Here are the page source when i test it in my laptop:

    <title>Index - abc System</title>
    <link href="/Content/jqueryui/jquery-ui.css" rel="stylesheet"/>
<link href="/Content/jqsimplemenu.css" rel="stylesheet"/>
<link href="/Content/bootstrap.css" rel="stylesheet"/>
<link href="/Content/Site.css" rel="stylesheet"/>
<link href="/Content/datepicker.css" rel="stylesheet"/>

    <script src="/Scripts/modernizr-2.6.2.js"></script>

    <script src="/Scripts/jquery-1.10.2.min.js"></script>

    <script src="/Scripts/respond.js"></script>
<script src="/Scripts/moment.js"></script>
<script src="/Scripts/bootstrap.js"></script>
<script src="/Scripts/bootstrap-datepicker.js"></script>

    <script src="/Scripts/jquery-ui.js"></script>


    <!-- Script for menu -->
    <script src="/Scripts/jqsimplemenu.js" type="text/javascript"></script>

Here are the code for BundleConfig.cs:

public class BundleConfig
{
    // For more information on bundling, visit 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/jquery").Include(
                "~/Scripts/jquery-1.10.2.min.js"));

    bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
    "~/Scripts/jquery-ui.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/respond.js",
              "~/Scripts/moment.js",
              "~/Scripts/bootstrap.js",
              "~/Scripts/bootstrap-datepicker.js"));

    bundles.Add(new StyleBundle("~/Content/css").Include(
               "~/Content/jqueryui/jquery-ui.css",
               "~/Content/jqsimplemenu.css",
                "~/Content/bootstrap.css",
               "~/Content/Site.css",
               "~/Content/datepicker.css"));
    }
}

Here the result of the page after i publish in server:

enter image description here

Here are the expected result:

enter image description here

Error in the page:

enter image description here

Can i know how to resolve this issue? Thanks.

eikaz
  • 401
  • 8
  • 17
  • 1
    The published version is combined and minified for performance. While debugging it leaves the resources unpacked so it's easier to debug. – Jasen Apr 28 '15 at 03:32
  • 2
    It's working. nothing strange. that's how bundles work when debug mode is off. it merges files included in a bundle to reduce calls to server. – Reza Abolfathi Apr 28 '15 at 03:34
  • when browse my website after publish, seems that certain css does not load..my website looks ugly compare when i run using my laptop..that's why i think maybe this is because of the render problem..is there anything needs to be done before/after publish? – eikaz Apr 28 '15 at 03:38
  • First, check that you don't get any 404 Not Found. You also have two `jquery` bundles -- you can get rid of the one for `~/Scripts/jquery-1.10.2.min.js`. – Jasen Apr 28 '15 at 03:45
  • i dont get any 404 not found..is it because of ~/Scripts/jquery-1.10.2.min.js ? – eikaz Apr 28 '15 at 03:49
  • Why you have bundle `"~/bundles/jquery"` twice? Also you should show us your cshtml file so we can see how you are referencing the bundles. – Rosdi Kasim Apr 28 '15 at 03:57
  • Eikaz, I bet there is 404 errors.. you are just not seeing it. Press F12 in Chrome, then click on Network tab. Then refresh your page... you will see it there. If not then most likely the path to css in your bundle is wrong, ASP MVC will silently ignore missing files in bundle. – Rosdi Kasim Apr 28 '15 at 04:03
  • This usually happens when a css file is in a subdirectory that doesn't match the bundle name. It would be easier to figure out if you knew which set of styles are not being applied. Since `jquery-ui.css` is the only stylesheet not in a default place you could try moving that to the parent `Content` directory. – Jasen Apr 28 '15 at 04:04
  • @rosdi kasim..yes there is 404 errors but it say that only .png file not found..any solutions to alter my code? – eikaz Apr 28 '15 at 04:09
  • Show us your cshtml, and screenshot of the Chrome developer showing the 404. – Rosdi Kasim Apr 28 '15 at 04:26
  • already update the Chrome developer showing the 404..i already show the cshtml render in the post.. – eikaz Apr 28 '15 at 04:32
  • For the png not resolving, try this: `bundles.Add(new StyleBundle("~/Content/css") .Include("~/Content/jqueryui/jquery-ui.css", new CssRewriteUrlTransform()));` – Rosdi Kasim Apr 28 '15 at 04:41

3 Answers3

1

Try this :

  1. Check your web.config configuration and make sure compilation debug is set to false

  2. Open IIS Config -> Authentication -> right click on Anonymous Auth ->Click Edit -> Choose Application pool identity

Iswanto San
  • 18,263
  • 13
  • 58
  • 79
0

In your web.config add below in <system.webserver> node.

<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true" />
</system.webServer>

Hope this will fix your issue.

Kundan Singh Chouhan
  • 13,952
  • 4
  • 27
  • 32
0

Make a new bundle for jqueryui

bundles.Add(new StyleBundle("~/Content/jqueryui/css")
    .Include("~/Content/jqueryui/jquery-ui.css"));

bundles.Add(new StyleBundle("~/Content/css").Include(
        // "~/Content/jqueryui/jquery-ui.css",
           "~/Content/jqsimplemenu.css",
            "~/Content/bootstrap.css",
           "~/Content/Site.css",
           "~/Content/datepicker.css"));

The StyleBundle virtual path name should match the folder structure of your project. Style rules may contain path references to other subdirectories and these can't be resolved when your style bundle name does not match the physical location in your project.

.foo {
    background-image:url('../Images/foo.png');
}
Jasen
  • 14,030
  • 3
  • 51
  • 68