Solved

asp.net bundle

Posted on 2016-11-05
8
46 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
ID: 41875511
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
ID: 41875517
Framework 4.0
0
 

Author Comment

by:ITsolutionWizard
ID: 41875648
Any ideas?
0
 
LVL 22

Expert Comment

by:Snarf0001
ID: 41876242
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:ITsolutionWizard
ID: 41876386
Sound good but how to use it !?
0
 
LVL 75

Accepted Solution

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

Author Comment

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

Author Closing Comment

by:ITsolutionWizard
ID: 41889008
FindFiles works to me
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

932 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

12 Experts available now in Live!

Get 1:1 Help Now