Note that there are some explanatory texts on larger screens.

plurals
  1. POBundled JS at Home/Scripts/js after deployed to Azure with ASP.NET MVC 4
    primarykey
    data
    text
    <p>I have an ASP.NET MVC 4 web application. All my JS files are in the Script folder. I am bundling them all like this:</p> <pre><code>bundles.Add(new ScriptBundle("~/Scripts/js").IncludeDirectory("~/Scripts", "*.js")); </code></pre> <p>In Views/Shared I have _BootstrapLayout.basic.cshtml, with this call to the bundle:</p> <pre><code>&lt;script src="@Url.Content("~/Scripts/js")" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p>I have had it in the body and the head, and it makes no difference. When I run it locally in debug mode, it works just fine. When I deploy it, it does not work, and shows the following in the Chrome Console:</p> <pre><code>Failed to load resource: the server responded with a status of 404 (Not Found) http://mysite.azurewebsites.net/Home/scripts/js </code></pre> <p>"mysite" is the name of my website on Azure.</p> <p>Since the bundle is made to ~/Scripts/js, it will not find anytning in /Home/scripts/js. How do I fix this?</p> <p>UPDATE I:</p> <p>The reference issue has been fixed, thanks to @jamoerdyk's answer below. The script bundle should be included like this:</p> <pre><code>@Scripts.Render("~/Scripts/js") </code></pre> <p>Now, I still get an error and the scripts are not working. The Chrome Console looks like this:</p> <pre><code>Uncaught SyntaxError: Unexpected token * /scripts/js?v=fIEoVL9cKX9p8_aBxRN9dMr1OHqh5ZMjO7E8iZ7Z3hQ1:12 </code></pre> <p>Any ideas? Or is it not related at all?</p> <p>UPDATE II:</p> <p>The minification was failing - that was the second problem. So I stopped using bundling for a while, and make regular src-references to the scripts.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload