473,395 Members | 1,762 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

server application aspnet_wp.exe stopped unexpectedly unavailable

hi,

I'm having an absolute nightmare with this!

I've seen many posts on the subject but still can't quite figure it
out.

I'm using csharp and Framework 1.1.4322.537 on Windows2000 Professional
5.00.2195 Service Pack 4

I click a hyperlink which takes me to an aspx page with a document ID
in the request string. The aspx page checks if there is a doc_id in the
request string. If there is, it looks at a Session variable DataView to
find the location of the document based on the doc_id (don't want users
to see actual location).

Once it has this info, it puts that into another Session Variable and
does a Response.Redirect to the same aspx page but with a user-friendly
request string i.e document=documentType.documentName

On reentry, the page sees this request string, finds the location from
the session variable and uses the following code to serve the PDF file:
if(impersonateValidUser("user", "domain", "password"))
{
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType="application/pdf";
Response.WriteFile(pdfFile);
Response.Flush();
Response.Close();
undoImpersonation();
}
else
{
}
return;

using the standard MS implementation of impersonation found here:
http://support.microsoft.com/default...b;en-us;306158
EXCEPT that I am not doing it in Page_Load.

Code for Page_Load is:
//uses doc_id to identify which document from the dataset is required.
string objectName;
string objectType;
if (Request.QueryString["doc_id"] != null)
{
string docId = Request.QueryString["doc_id"];
System.Data.DataView documents =
(System.Data.DataView)Session["documents"];

if (documents == null)
throw new Exception("You must navigate via the Document Viewer and
select a document first.");
documents.RowFilter="doc_id="+ docId;
//check that there is a document
if (documents.Count==1)
{
objectName = documents[0].Row["object_name"].ToString();
objectType = documents[0].Row["r_object_type"].ToString();
pdfFile = (string)Session["pdfLocation"] +
documents[0].Row["DOCUrl"].ToString();
ArrayList pdfArray = new ArrayList();
pdfArray.Add(pdfFile);
pdfArray.Add(docId);
pdfArray.Add(objectName);
pdfArray.Add(objectType);
Session["pdfArray"] = pdfArray;
string newURL = HttpContext.Current.Request.Path + "?object=" +
objectType + "." + objectName;
Response.Redirect(newURL);
return;
}
else
{
throw new Exception("There is no such document id in the
current dataset.");
}
}
else
{
if (Session["pdfArray"] != null && Request.QueryString["object"] !=
null)
{
if (((ArrayList)Session["pdfArray"]).Count == 4)
{
pdfFile = (string)((ArrayList)Session["pdfArray"])[0];
objectName = (string)((ArrayList)Session["pdfArray"])[2];
objectType = (string)((ArrayList)Session["pdfArray"])[3];
string[] objRequest =
Request.QueryString["object"].Split(".".ToCharArray());
if (objRequest.Length == 2)
{
if (objRequest[0] != objectType || objRequest[1] != objectName)
throw new Exception("This is not a valid document.");
}
else
throw new Exception("This is not a valid document.");
ServePDF();
return;
}
else
{
throw new Exception("This is not a valid document.");
}
}
else
{
throw new Exception("This is not a valid document.");
}
}

string pdfFile is a class variable.

Now, this code works fine for 3 of my documents which are under 200kb
but the one that is 3822KB fails with the error message Server
Application Unavailable and the event log says aspnet_wp.exe stopped
unexpectedly.

The machine.config is set to use SYSTEM (though with Framework 1.1 I
don't think this should be necessary, and indeed it may not be - have
now tested "machine" and that seems to work the same). The httpRuntime
MaxRequestLength in machine.config was 4096 and since this was close I
upped it to 8192 but that didn't fix it. This setting is not overridden
in the web.config file.

What may give the game away (but not to me!) is that the Page_Load is
triggerred 3 times instead of the 2 I was expecting. Once with the
doc_id, then after the Redirect but then a third time??? Presumably
something to do with the Response.Flush or Response.Close...

Can anyone help me? Even more frustrating is that I actually had this
big file working occasionally yesterday though it would randomly cause
this error message. However, after my tinkering it always produces the
error now :o( (only for the large file).

thanks
Phil

Nov 19 '05 #1
4 1386
i should say I have also tried without impersonation (having set the
directory permissions appropriately, though my final application will
need to use impersonation or delegation - that's a whole different
question!).

Even without impersonation I still get the same problem.

Phil

Nov 19 '05 #2
can someone at least tell me why Page_Load is being triggerred 3 times
in this example?

I really can't figure out why the failure is so random...

Nov 19 '05 #3

ph*****@2bytes.co.uk wrote:
can someone at least tell me why Page_Load is being triggerred 3 times in this example?

I really can't figure out why the failure is so random...

That's a bug. Install .net framework 1.1 sp1. this would help.

Nov 19 '05 #4
by the way, for anyone else having this problem, it turned out to be
the size of the file at 3822KB. I ended up having to read it in chunks
and outputting it with flush before reading the next chunk. I used
500000 byte chunks and it seems to work fine. There may be an
alternative solution but this is what I ended up doing.

Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: warlord | last post by:
I have a Crystal report that I'm calling from a website - the report executes and then exports to a PDF, and then the PDF is then shown in a new browser window. It runs fine the first time, but any...
0
by: Umair Ahmed | last post by:
Hi, I m developing a web application on Win2k platform and deploying the application on Win2k platform. I didnt get any error on the development machine but when i deployed to any machine on...
4
by: Dave Diehl | last post by:
Has anyone heard of a problem with a rebuild of one application causing a problem with another app on the same server? I have two asp.net applications on the same Win2000 server, each with it's...
2
by: Erik Lindeblom | last post by:
I can suddenly no longer browse any of my ASP.net web services. The browser returns: Server Application Unavailable and tells me to look at the Application Event Log for more details. I have...
0
by: RT | last post by:
I am getting the following message when I try to access the asp.dotnet pages of our website. "Server Application Unavailable The web application you are attempting to access on this web server...
0
by: bruce | last post by:
ASP.NET app running for about a year with no problem and suddenly this week it's giving error message. The same as the one decribed by another user. Even stranger is that we only have this problem...
1
by: Paul Wasowicz | last post by:
Configuration: Windows 2000 Server SP4 ..Net Framework 1.1 SP1 Microsoft Site Server 3.0 Problem: the following error messages start showing up in the EVENT LOG on the server every once in a...
17
by: Jon B | last post by:
Hi All! I have a ASP.NET 2.0 site that works on the Windows 2000 Server. However, when I tried to view this site on my local Windows XP machine, I get "Server Unavailable". If I switch the...
17
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
I have set up a virtual directory using IIS. Whenever, I load a web page of type .htm, I have no problem. Whenever I run a .aspx page I get the statement below. I am running on XP Pro, both...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.