Solved

asp.net bundle

Posted on 2016-11-05
8
32 Views
Last Modified: 2016-11-15
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;
0
Comment
Question by:ITsolutionWizard
  • 5
  • 2
8 Comments
 
LVL 22

Expert Comment

by:Snarf0001
Comment Utility
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.
0
 

Author Comment

by:ITsolutionWizard
Comment Utility
Framework 4.0
0
 

Author Comment

by:ITsolutionWizard
Comment Utility
Any ideas?
0
 
LVL 22

Expert Comment

by:Snarf0001
Comment Utility
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.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:ITsolutionWizard
Comment Utility
Sound good but how to use it !?
0
 
LVL 74

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
Comment Utility
You need to debug your FindFiles method--it's returning no items.
0
 

Author Comment

by:ITsolutionWizard
Comment Utility
I downloaded it and how to work with my existing solution ?
0
 

Author Closing Comment

by:ITsolutionWizard
Comment Utility
FindFiles works to me
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now