0

This my settings:

public static void RegisterBundles(BundleCollection bundles)
    {
        bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                    "~/" + Links.Scripts.jquery_2_1_1_min_js,
                    "~/" + Links.Scripts.jquery_migrate_1_2_1_min_js,
                    "~/" + Links.Scripts.calendar.jquery_ui_datepicker_cc_all_min_js
                    ));
    }
    protected void Application_Start()
    {
        RegisterBundles(BundleTable.Bundles);
        BundleTable.EnableOptimizations = true;
    }

Use this code in Layout view:

@Scripts.Render("~/bundles/jquery")

In VS no problem. But when publish my project and deploy it in IIS8.0 unable to generate VersionQueryString,this is HTML output:

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

But this is a problem.Html Output must be something like this:

<script src="/Test/bundles/jquery?v=D8YBlpJkSh-c2SxXkODfl3ftU01p3BTOtqGF3Uuuq9E1"></script>

What reason will cause the unable to generate VersionQueryString?

1 Answers1

0

Change this lines

public static void RegisterBundles(BundleCollection bundles)
{
    bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                "~/" + Links.Scripts.jquery_2_1_1_min_js,
                "~/" + Links.Scripts.jquery_migrate_1_2_1_min_js,
                "~/" + Links.Scripts.calendar.jquery_ui_datepicker_cc_all_min_js
                ));
}

to

public static void RegisterBundles(BundleCollection bundles)
{
    bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                VirtualPathUtility.ToAppRelative(Links.Scripts.jquery_2_1_1_min_js),
                VirtualPathUtility.ToAppRelative(Links.Scripts.jquery_migrate_1_2_1_min_js),
                VirtualPathUtility.ToAppRelative(Links.Scripts.calendar.jquery_ui_datepicker_cc_all_min_js)
                ));
}

VirtualPathUtility.ToAppRelative: Converts a virtual path to an application-relative path using the application virtual path that is in the System.Web.HttpRuntime.AppDomainAppVirtualPath property.