2

I have a c# MVC webapplication running on a IIS server with bundled javascript.

The application runs smoothly, but once a while for some reason a few scripts won't load. Its always Jquery, Jquery UI and JSSOR slide, a few dozen other files don't have this problem, after i modify the files on the server it works again. So it seems to be a caching issue.

It doesn't occur much, but the problem is that it stops working for a random browser/user, but still works for others. The only thing that works so far is modifying those files.

I'm not sure in which area the problem could come from, so i'm unable to provide any relevant code/config. But if needed i could post it here.

5
  • are you using a minified version of those scripts? Commented Dec 22, 2015 at 9:20
  • I'm sure I had a similar issue with images and set the cache-control header in IIS so that content expired after only a few minutes. The answer from 360Airwalk in this thread has some information on it. Unfortunately I don't fully understand the implications of doing this so I'm posting a comment. In my case it was a small internal site so I wasn't worried about setting it myself. Commented Dec 22, 2015 at 9:39
  • I'm not using a minifed version of those scripts, but the standard MVC Bundling does minify them after bundling, and thanks for the tip Equalsk, i'll look into that, problem is that its quite a large application, so i'll have to check what it does to the performance of the whole application Commented Dec 22, 2015 at 9:46
  • I'm no IIS expert, but I'm pretty sure you can set the HTTP headers on particular portions of the site rather than the whole thing. In my case my images were all in one folder so I set the headers on resources from that folder only, the rest of the site remained unaffected. As long as your Javascript files are in a similar structure then it sounds like the rest of your site should remain unaffected. Good luck! Commented Dec 22, 2015 at 10:39
  • Thanks, i've set the specific headers in the scripts folder, application seems to be running fine now. The problem is that the bug can't be reproduced whenever i want it, so hopefully i won't find it anymore Commented Dec 22, 2015 at 10:56

1 Answer 1

0

Probably you got the problem with your cache control on the IIS server. please check it. and again, please check if your jquery files are taking time to load and if it is called before they are initialised. and have a look if you're using async and calling the files way before its initialised.

Sign up to request clarification or add additional context in comments.

2 Comments

If the problem occurs, the scripts won't load at all, not slowly, but not at all. So yeah the scripts are called before they are initialised, but the scripts never will initialize because the files aren't loaded.
@DLE Agreed. at times, it may lead to error that script is not there initialised. Hence., please check when its initialised.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.