0

I have the following view contain a bundle :-

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

but when i deploy the view on IIS the script inside the bundle did not fire and when i check the page source i found the following :-

<script src="/bundles/sort?v="></script>

where usully the bundle have a value after the v=" ... can anyone advce what might be the problem ?

the bundle is as follow:-

 bundles.Add(new ScriptBundle("~/bundles/sort").Include(
                       "~/Scripts/sort.js"));

Thanks

John John
  • 1
  • 72
  • 238
  • 501
  • I suppose you have checked whether sort.js is really where it should be. – Santhos May 15 '14 at 16:16
  • yes it is inside the Scripts folder .. the strange thing is that if i directly reference the script it will work fine,, also the deploy the same view on the staging server and it worked fine ........ strange behavior !!! – John John May 15 '14 at 16:18
  • again the bundle is working on the staging server , but on the production server it does not, and if i reference the script directly inside the view the script will work on the production server,, this means that the script is in the right place ?? – John John May 15 '14 at 16:32
  • yes, that means the script is in right place. – Santhos May 15 '14 at 16:34
  • Do you deploy the same version to stage and to production? - meaning both are debug or release code – Santhos May 15 '14 at 16:36
  • yes both servers have the same code – John John May 15 '14 at 16:36
  • I found this but I think you did as well: http://stackoverflow.com/questions/21270834/asp-net-mvc-bundle-not-rendering-script-files-on-staging-server-it-works-on-dev I am out of ideas. Sorry – Santhos May 15 '14 at 16:40
  • Make sure .min.js files are there and debug=false in web.config – malkam May 15 '14 at 17:27
  • Are you sure that permissions of your live website are correct? Looks like bundle was build not completely. – Dmitry Zaets May 15 '14 at 19:04
  • Anything else in your RegisterBundles declaration such as MapPathMethod? – SkyBlues87 May 16 '14 at 12:52

1 Answers1

0

I know this issue has probably long since been resolved, but I just stumbled upon this exact problem years later, and thought I'd post how I solved it in case anyone else encounters this.

For me, the problem was that the .js file was not included in the .csproj, which apparently resulted in the file not getting bundled. Simply including the javascript file in the project and then redeploying to staging fixed the problem.

Matt Dalzell
  • 775
  • 3
  • 14