0

When I deploy my basic MVC project to IIS7 Server and access it from another machine I'm getting an error message. I published the project and then copied the project directory to the web server. Base MVC EF project no modifications. Is this a bundling problem?

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0E; .NET4.0C; InfoPath.3)
Timestamp: Tue, 22 Dec 2015 17:03:23 UTC


Message: Object doesn't support this property or method
Line: 1
Char: 131710
Code: 0
URI: http://webtest2/MTS/bundles/jquery?v=jhHgG52S4BptEJYwPMHStzU36M_CwPgb7D46X0OQckM1

My _layout.cshtml when created the project

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title - My ASP.NET MVC Application</title>
    <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <meta name="viewport" content="width=device-width" />
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
</head>
<body>
    <header>
        <div class="content-wrapper">
            <div class="float-left">
                <p class="site-title">@Html.ActionLink("your logo here", "Index", "Home")</p>
            </div>
            <div class="float-right">
                <section id="login">
                    Hello, <span class="username">@User.Identity.Name</span>!
                </section>
                <nav>
                    <ul id="menu">
                        <li>@Html.ActionLink("Home", "Index", "Home")</li>
                        <li>@Html.ActionLink("About", "About", "Home")</li>
                        <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
                    </ul>
                </nav>
            </div>
        </div>
    </header>
    <div id="body">
        @RenderSection("featured", required: false)
        <section class="content-wrapper main-content clear-fix">
            @RenderBody()
        </section>
    </div>
    <footer>
        <div class="content-wrapper">
            <div class="float-left">
                <p>&copy; @DateTime.Now.Year - My ASP.NET MVC Application</p>
            </div>
        </div>
    </footer>

    @Scripts.Render("~/bundles/jquery")
    @RenderSection("scripts", required: false)
</body>

I am stumped and have spent almost 2 weeks trying to get this to work. I know this is basic and everyone should know the answer but I just can't get past it even after looking at other questions like this.

BundleCOngif.cs

using System.Web;
using System.Web.Optimization;

namespace MTS
{
  public class BundleConfig
  {
    // For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
    public static void RegisterBundles(BundleCollection bundles)
    {
        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 StyleBundle("~/Content/css").Include("~/Content/site.css"));

        bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
                    "~/Content/themes/base/jquery.ui.core.css",
                    "~/Content/themes/base/jquery.ui.resizable.css",
                    "~/Content/themes/base/jquery.ui.selectable.css",
                    "~/Content/themes/base/jquery.ui.accordion.css",
                    "~/Content/themes/base/jquery.ui.autocomplete.css",
                    "~/Content/themes/base/jquery.ui.button.css",
                    "~/Content/themes/base/jquery.ui.dialog.css",
                    "~/Content/themes/base/jquery.ui.slider.css",
                    "~/Content/themes/base/jquery.ui.tabs.css",
                    "~/Content/themes/base/jquery.ui.datepicker.css",
                    "~/Content/themes/base/jquery.ui.progressbar.css",
                    "~/Content/themes/base/jquery.ui.theme.css"));
    }
  }
}
farmer
  • 47
  • 1
  • 1
  • 10
  • Try to comment all bundling @Styles.Render("~/Content/css") @Scripts.Render("~/bundles/modernizr") – Nika Javakhishvili Dec 22 '15 at 17:36
  • removing the @Styles.Render("~/Content/css") & @Scripts.Render("~/bundles/modernizr") at the top & @Scripts.Render("~/bundles/jquery") at bottom. The page loaded fine. Didn't have the blue head and like - but loaded fine - no error. – farmer Dec 22 '15 at 17:49
  • Did you try to deploy new application? Maybe there is a reference error. Also try to open this file in browser http://webtest2/MTS/bundles/jquery?v=jhHgG52S4BptEJYwPMHStzU36M_CwPgb7D46X0OQckM1 – Nika Javakhishvili Dec 22 '15 at 18:01
  • Also see the link : http://stackoverflow.com/questions/21270834/asp-net-mvc-bundle-not-rendering-script-files-on-staging-server-it-works-on-dev – Nika Javakhishvili Dec 22 '15 at 18:02
  • Does your code run on your local machine with `BundleTable.EnableOptimizations = true`? Do you get errors on the deployment server with optimizations disabled? What does your BundleConfig look like? – Jasen Dec 22 '15 at 18:33
  • This is a new application - new web site on the IIS server. the webtest2/MTS/bundles gets The resource cannot be found. HTTP 404 - there is not a bundles directory on the web server under that MTS directory – farmer Dec 22 '15 at 18:52
  • @Jasen yes the code will run on my local machine that have the application - and it will run when I'm logged into the web server - error when try it from another machine to the web server – farmer Dec 22 '15 at 18:55
  • What version of jQuery? What browser and version thereof are you testing in? – Chris Pratt Dec 22 '15 at 19:32
  • 1
    Let me start with the basics - I created a New ASP.NET MVC 4 Web Application project - then Published it to the new test Web site - didn't include any NuGet packages yet - could that be the issue - seems like the base app should owrk – farmer Dec 22 '15 at 19:44
  • In the project added jQuery 2.1.4 , EntityFramwwork 6.1.3 & Bootstrap CSS 3.3.6 from NuGet for the project - Using IE 10 on the client – farmer Dec 22 '15 at 19:52
  • after adding NuGet packages & publishing to web server I get the message Webpage error details. Maybe bundling isn't for me User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0E; .NET4.0C; InfoPath.3) Timestamp: Tue, 22 Dec 2015 21:26:39 UTC Message: Object doesn't support this property or method Line: 1 Char: 224262 Code: 0 URI: http://webtest2/MTS/bundles/jquery?v=lpnRyk-Kl-iQwpx69XgEjycLfhsLSn35cO9AB05Tev01 – farmer Dec 22 '15 at 21:28
  • Thanks everyone - looked at the link till my eyes are crossed - maybe this will resolve itself over Christmas :) – farmer Dec 23 '15 at 19:26

0 Answers0