Response - Finding Memory Usage During Download?
Jan 22, 2010
On an ASP.net site at my place of work, the following chunk of code is responsible for handling file downloads (NOTE: Response.TransmitFile is not used here because the contents of the download are being streamed from a zip file):
[code]....
I've just read about the 'buffer' property of the Response object. If I set that to false, will that prevent the Response.BinaryWrite() calls from buffering the data in memory? In general, what is a good way to limit memory usage in this situation? Perhaps I should stream from the zip to a temporary file, then call Response.TransmitFile()?
EDIT: In addition to possible solutions, I'm very interested in explanations of the memory usage issue present in the code above. Why would this consume far more than 1MB, even though Response.Flush is called on every loop iteration? Is it just the unnecessary heap allocation that occurs on every loop iteration (and doesn't get GC'd right away), or is there something else at work?
View 1 Replies
Similar Messages:
Nov 10, 2010
We got "out of memory" issue on production servers. What API can we use to get live memory (physical and managed) usage of the ASP.NET application?
PS: we're forbidden to profile memory with tools.
View 4 Replies
Feb 16, 2011
I have really tried to Google it but only articles about how to troubleshoot memory issues come up. Before I start to troubleshoot, I would like to know if my web site's memory usage is really abnormal or not.
So it is an asp.net mvc 2 website that runs on IIS 7.5 in production. I guess normal memory usage depends upon traffic, so here are the numbers of an average day:
300 unique visitor
400 visits
3000 page views
I would be really happy to get some idea how much is the normal memory usage for this traffic. Also I would be curious to know how memory usage normally increases with traffic growth.
View 1 Replies
Jan 5, 2011
I have an ASP.NET app that scrapes data from a handful of external pages, parses the relevant bits and displays them in a table. Total data retrieved is 3-4MB and the resulting page is about 1MB. I am using synchronous WebRequest GetResponse for the retrieval, but the same problem existed using an asynchronous BeginGetResponse/EndGetResponse process.There is no database access, no session storage, no caching, but an in-memory list of about 100 objects (total 1MB of data), plus a good amount of AJAX (AjaxControlToolkit). This issue appears on the very first run of the app, even if I have restarted IIS.
The issue:
When I run the app on my dev computer, the maximum commit charge is about 1.5GB. The biggest user, measured by Task Manager's VM Size, is WebDev.WebServer.exe (600MB). The app runs perfectly.
When I run it on my rent-a-server (IIS 7.5, 1GB RAM), the maximum commit charge is over 3.8GB. The biggest user is w3wp.exe at 2.7GB. IIS grinds to a halt and spits out a timed-out error page.
Given my limited server budget and the hope of having multiple simultaneous users, I'm kind of in a panic.
Is this normal? If I bump the server RAM up to 4GB, will that be enough?
View 3 Replies
Jan 6, 2011
I have an ASP.NET 3.5 app that collects data from a handful of external pages, parses the relevant bits and displays them in a table. Total data retrieved is 3-4MB and the resulting page is about 1MB. I am using synchronous WebRequest GetResponse for the retrieval, but the same problem existed using an asynchronous BeginGetResponse/EndGetResponse process.
There is no database access, no session storage, but an in-memory list of about 100 objects/1MB of data, plus a good amount of AJAX (AjaxControlToolkit). This issue appears on the very first run of the app, even if I have restarted IIS.
The issue:
When I run the app on my dev computer, the maximum commit charge is about 1.5GB. The biggest user, measured by Task Manager's VM Size, is WebDev.WebServer.exe (600MB). The app runs perfectly.
When I run it on my rent-a-server (IIS 7.5, 1GB RAM), the maximum commit charge is over 3.8GB. The biggest user is w3wp.exe at 2.7GB. IIS grinds to a halt and spits out a timed-out error page.
Given my limited server budget and the hope of having multiple simultaneous users, I'm kind of in a panic.
View 3 Replies
Nov 26, 2010
I have a update panel combined with gridview with sorting and paging.
I go into task manager to monitor the memory usage of the worker process (w3wp)
What I do is just click on the sort buttons rapidly.
With each click the memory of the process increases with about 2 mb
So I go from 30 mb memory usage to about 90. Then it stops at remains there, no memory is freed up. I am not using caching or session/application state.
What can be causing this, is there a setting in IIS to reduce the mem usage?
I also used .net profiler to examine my app memory usage: 4 mb, so what is the other 86 used for??? Even though it repots 4mb, in task manager it says 90 mb, so this leads me to believe that the rest is namanaged memory which must be used by IIS in some way.
View 2 Replies
Feb 3, 2011
I am hosting a solution with an outside company so getting them to troubleshoot or send me log files is not working.
Is there a way from code or Global.asax file that I can trap Memory usage from my web application when it reaches a certain amount? Then figure out what is using all the memory
View 2 Replies
May 17, 2010
I would like to use output caching with WCF Data Services and although there's nothing specifically built in to support caching, there is an OnStartProcessingRequest method that allows me to hook in and set the cacheability of the request using normal ASP.NET mechanisms.
But I am worried about the worker process getting recycled due to excessive memory consumption if large responses are cached. Is there a way to specify an upper limit for the ASP.NET output cache so that if this limit is exceeded, items in the cache will be discarded?
I've seen the caching configuration settings but I get the impression from the documentation that this is for explicit caching via the Cache object since there is a separate outputCacheSettings which has no memory-related attributes.
Here's a code snippet from Scott Hanselman's post that shows how I'm setting the cacheability of the request.
[code]....
View 1 Replies
Feb 25, 2011
I'm using asp.net and chrome and the page becomes unresponsive after a while. When I look at the chrome debug, I see that memory usage increases to about 80MB and chrome popups a request to kill the page. The error counter spins and generates about 30,000 errors when the popup comes. What triggers the error is the call of an updatepanel. The error as displayed in chrome is "Failed to load resource".
The update panel: the user clicks on a button and the panel is refreshed. There's only one update panel on the page.
This is what I have:
function HistoryUIActions() {
$('.SelectDay, .SelectDay1Digit').click(function () { GetNewDate(this); });
};
function GetNewDate(thedateitem) {
var TheDay = $.trim($(thedateitem).html());
TheYear = 2011;
ThisMonth = 2;
DateString = ThisMonth + '/' + TheDay + '/' + TheYear;
__doPostBack('<%= TheUpdatePanel.ClientID %>', DateString);
};
function EndRequestHandler(sender, args) {
HistoryUIActions();
};
The errors compound on every postback: 1,4, 11, 26, 57, 120, 247.... eventually chrome kills the page. When I put a breakpoint in the function, it stops the code just after I press the button; then after it hits the __doPostBack line, it starts the GetNewDate function again several times by going back to the line of the click event, apparently executing it the number of times shown above.
View 1 Replies
Feb 11, 2010
Is there a way to get load information on Application Server? How much memory or CPU is being used at a given point? I want to either 1. Limit users to use specific functionality of ASP.NET 3.5 application or 2. Deny users from accessing the application saying "Server is busy at the moment"
View 4 Replies
Oct 12, 2010
Is there a way to check the memory usage (consumption) of individual controls on a web form shown in a browser. Like Repeater Control, Multiline Text box etc. The reason is I am putting the repeater control in session and checking the status of controls, based on which I am doing further actions.
View 2 Replies
Jul 31, 2010
Environment.WorkingSet incorrectly reports the memory usage for a web site that runs on Windows 2003 Server.(OS Vers: Microsoft Windows NT 5.2.3790 Service Pack 2, .NET Vers: 2.0.50727.3607)
It reports memory as Working Set(Physical Mem.): 1952 MB (2047468061).
Same web site runs locally on Windows Vista with a Working Set(Physical Mem.): 49 MB (51924992).
I have limited access to the server and support is so limited.
so i have computed the total memory by traversing with VirtualQuery.
Total of pages with state: MEM_FREE is 1300 MB.
(I guess server have 4 GBs of RAM and PAE is not enabled, max user mode virtual address is 0x7fff0000.)
So, i know working set is not only about virtual memory. But, is it normal to have such a high working set while its very low on another machine?
View 2 Replies
Jan 3, 2011
I am trying to force a download of an XML file when the user visits a page.
This is the code I am using
public partial class GenerateTemplate : LayoutsPageBase
{
protected void Page_Load(object sender, EventArgs e)
{
//.............
//Going about generating my XML
//.............
Response.ClearContent();
Response.AddHeader("content-disposition", "attachment; filename=template.xml");
Response.Write(xmlDoc.InnerXml);
Response.Flush();
Response.Close();
}
}
I am facing a problem that my download window hangs indefinitely, without ever completing the download/Open of the file.
What am I doing wrong? Am I not disposing any objects or closing any connections here?
View 4 Replies
Feb 20, 2011
I am dynamically generating a file from server based on user input. I need to provide a download button which, upon clicking, downloads a file to the user's file system. Also, the user might click the same button twice, upon which the file should download again.The dynamic generation of file rules out the HttpResponse.TransmitFile() option, which suports mutliple download.Almost every other option I have come across needs Response.End() to be invoked, which prevents a second download.How do I satisfy the 'multiple download" requirement?Read up on Virtual Path providers, which might enable me to use TransmitFile(), but that looks like an overkill for such a simple requirement.
View 2 Replies
May 7, 2010
I have to large files in a database which users can download. The user clicks a link and the following code runs:
[Code]....
View 1 Replies
Mar 31, 2010
I have following function which is called from a button click event
[Code]....
I am creating a zip file on the fly and wanted to download this file.Problem is that in Internet explorer when I click the button the download accelrator comes with file name as my page saying resume opendialogueif i click open then DAP window close and normal windows download manager comes but the event of my button fires multiple time?I don't know what to do with it
View 6 Replies
Jan 21, 2010
I have a download page with a linkbutton that users use to download files. The event handler of the linkbutton sets up the Response type for the user to see the download dialog and chose to save it. I need to find out accurately how many times the file has been downloaded. If I increment a counter in the link button's event handler, I'd assume it wouldn't be accurate as the user may chose to click on Cancel in the download dialog.
Where exactly do I need to hook this counter incrementing logic?
View 2 Replies
Oct 13, 2010
I have an webapp which dynamically generates a file and stores it on the server. When a user comes along, this file is served, after which it gets deleted. Each user gets their own generated file after which it becomes useless.Is there a way to know if the user managed to download the file fully, so that it may be deleted and not clogging up my server with outdated files?At the moment the problem is a user is clicking "Download file" then it being cancelled or failed, so they try again but its been deleted.
View 2 Replies
Feb 20, 2010
I have a flash image slider with a button below each image. When i press that button, the user is redirected to a new page where i add that image product to my cart. The problem is that after doing the adding, i want to redirect the user back to the initial page.
The code:
protected void Page_Load(object sender, EventArgs e)
{
addProductToBasket(getCategoryIdFromUrl(), getProductIdFromUrl());
Response.Redirect(Request.UrlReferrer.ToString());
}
note that in Firefox is working fine but in IE or Chrome it is DOWNLOADING the swf...If i comment Response.Redict(...) the user remains on this page so the click button is working well, only the redirect seems to be the problem.
Edit: The problem seems to be that Request.UrlReferrer keeps as link not the initial page containing the swf but the swf itself.
So, instead of doing redirect to:[URL] if does redirect to the swf contained on the Index.aspx page[URL]
Solved: with a session variable where i keep the initial page's url
View 1 Replies
Jun 9, 2010
I've a question about something I'm searching for,for too long! We've build an application from which an admin upload songs into a database. Then user can bought songs and download it individualy. The problem is that when user download MP3 songs with the code below, it works great in Firefox and Chrome but not in IE8 simply because WMP trying to open the songs and it just don't get it instead of having a "Save as" dialog? Any issue on HOW can i force to have the "Save As" diaglog? Note that I have not MP3 physicaly on server it's in database. So I can't direct link to song ...
Here's my code :
// Remove "specials chars"
foreach (char aChar in @"/:*?""<>| ") {
if (aChar == ' ') {
songNameAndExt = songNameAndExt.Replace(' ', '_');
} else {
songNameAndExt = songNameAndExt.Replace(aChar.ToString(), string.Empty);
}
}
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
HttpContext.Current.Response.ContentType = "application/octet-stream";
HttpContext.Current.Response.Headers.Add("Content-Disposition", string.Format("filename={0}", songNameAndExt));
HttpContext.Current.Response.OutputStream.Write(songData, 0, songLength);
View 1 Replies
Oct 19, 2010
I have some code on an aspx page then when users loads the page it starts downloading a zip. Looks like this:
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileSaveName);
Response.TransmitFile(zipPath);
Response.End();
The problem is the FIRST time this is hit I get the following error:
The zip file exists and is not in my wwwroot. If I refresh the page the file will download fine.
If I wrap the code in a Try Catch I get a System.Threading.Threadabort exception with the message:
Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.
NOTE: I actually get that exception every time. I guess its just to do with the Response.End
View 1 Replies
Feb 16, 2010
I'm working on some code that generates an Excel spreadsheet server-side and then downloads it to the user. I'm using ExcelPackage to generate the file.
The generation is working just fine. I can open the generated files using Excel 2007 with no issues. But, I'm having trouble downloading the file with Response.TransmitFile().
Right now, I have the following code:
//Generate the file using ExcelPackage
string fileName = generateExcelFile(dataList, "MyReportData");
Response.AddHeader("content-disposition", "attachment;filename=FileName.xls");
Response.ContentType = "application/vnd.xls"
Response.Charset = "";
Response.TransmitFile(fileName);
When Excel 2007 opens the file downloaded as above, it gives the "file format doesn't match extension" warning. After clicking past the warning, Excel displays the raw xml contents of the file. If I change the file extension, like so Response.AddHeader("content-disposition", "attachment;filename=FileName.xlsx");
Excel 2007 gives an "Excel found unreadable content in the file" error, followed by a dialog that offers to locate a converter on the web. If I click "no" on this dialog, Excel is able to load the data.
I've also experimented with different MIME types, like application/vnd.ms-excel and application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, combined with file extensions of .xls and .xlsx. All combinations result in one of the two behaviors mentioned above. What is the correct combination of file extension and MIME type to use in this scenario? What else could cause this failure, other than an improper MIME type or extension? FYI, this is occurring with Visual Studio's built-in development web server. I haven't yet tried this with IIS.
View 1 Replies
Jan 8, 2010
I am using a gridview to display (open or save) files that have been uploaded into a SQL 2005 server. I have a templatefield within the gridview that contains a linkbutton that does a postback to GetUploadedFile.aspx that then fires the response.binarywrite() code. The code seems to work fine and opens/saves the files correctly. But once this has completed and I try and click on another button on the page, instead of doing the appropriate action it re-fires the getuploadedfile.aspx binarywrite code and opens up the "Open/Save/Cancel" dialog again.
[Code]....
[Code]....
[Code]....
View 4 Replies
Mar 27, 2010
HOw to hide servername and url download by using reponse.redirect in asp.net 2.0.
View 8 Replies
Feb 5, 2010
How can i Hide download path in asp.net when i am using reponse.redirect("abc.zip") ?
Example if i used reponse.redirect("abc.zip") but if reponse.redirect("abc.zip") is wrong path it will display error with our full download path .if it right path it working fine .
If Clscon.rs.Read Then
Response.Redirect(Clscon.rs(9))
End If
View 7 Replies