Link to home
Start Free TrialLog in
Avatar of ITsolutionWizard
ITsolutionWizardFlag for United States of America

asked on

asp.net bundle

http://madskristensen.net/post/performance-tuning-tricks-for-aspnet-and-iis-7-e28093-part-2

I followed exact same way above but my website still have alert below.
The only different is the folder name. Do you have any ideas how to fix it?

Sequence contains no elements

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Sequence contains no elements

Source Error:


Line 113:                string absolutePath = HostingEnvironment.MapPath(relativePath);
Line 114:                FileInfo[] files = FindFiles(absolutePath);
Line 115:                DateTime lastModified = files.Max(f => f.LastWriteTime);
Line 116:
Line 117:                int index = relativePath.LastIndexOf('/') + 1;
Avatar of Snarf0001
Snarf0001
Flag of Canada image

What version of .net are you running?
Have you looked at the nuget optimization package?  It's generally included in most project templates in VS, and will do 99% of the underlying work for you (including watching for file modifications and rewriting the bundle).

Very efficient, and no point re-inventing the wheel.

If for some reason you can't use it, would need more info on your file structure and code to see what the problem could be.  But looks like it's not finding the files, which "possibly" could be due to a lock when overwriting.
Avatar of ITsolutionWizard

ASKER

Framework 4.0
Any ideas?
If it's 4.0, I would try the MS bundling package.
Nuget under:
https://aspnetoptimization.codeplex.com/

You have to modify some global.asax items and add a few things, but documentation and online samples should get you there.  Very quick and easy to use and does most of the heavy lifting.

If you make a new project it should already be included, which may help in the setup steps just for reference.

If you don't want to use that, as mentioned, would need more details on file structure, and what / when / how often your getting exceptions.
Sound good but how to use it !?
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I downloaded it and how to work with my existing solution ?
FindFiles works to me