w3wp has handle on download files - asp.net

I set up iis to handle .exe with "asp.net 2.0"s isapi filter to enable dynamic url replacement.
For this I setup the extension in iis and added the following line to web.config. Works fine so far.
<add path="*.exe" verb="*" type="System.Web.StaticFileHandler" />
the problem is that form that point w3wp process has several handles on these files. Most likely because someone is downloading them at the moment.
Is there a way to tell iis/asp.net not to put a exclusive handle on the file? I want to replace them even if the site is running. This works as long as asp.net does not handle these files.

I don't think there is a way to do this. You are telling IIS to handle this filetype, so the server is assuming a certain exclusivity. This behavior is intended IMO, because it prevents corrupted files in production environment.
Maybe it helps to limit the requests to some selected HTTP verbs (POST/GET), but i don't see any other options.
And the other question is: why do you want to replace a file, that is currently downloaded by a user? It will corrupt his download, forcing him to start all over again.

Related

Getting 403/404/500 errors when trying to launch/publish an ASP.NET MVC app

I'm trying to learn ASP.NET and .NET/C# for work. I wasn't able to find how to make something go live...the right way. Every instruction I find forgets to speak on how to make an app live.
Taking it into my own hands, I've triend many things and I was able to publish my files online to my Godaddy hosting account (PLESK), but I kept getting 403/404/500 errors.
Eventually after a few days and trying a few things, I was able to get a basic test page up by editing web.config and as an example, adding something like:
<defaultDocument enabled="true">
<files>
<add value="MYHOMEPAGEFILEHERE.html" />
</files>
</defaultDocument>
This worked because it's so basic and it points to basic html file, but the problem I'm having though is that I'm trying to launch a site that has razor/routes established/classes and C# stuff (no DB yet) and on my local machine, the site/app works but when I upload it, it always breaks and I get 403s, 500s etc...
I thought to myself "maybe add default document path/value to any of the starting C# files, like I would do in a MEAN app (via app.js)".
But when I looked in the server, none of those files are there, I'm going to assume that all the C# files, are compiled into dll files?
If this is the case, how do I go about instructing the server to start at any particular file? Essentially, what can I do, to upload my working mini app(locally) to an online server, and it just work?
I've followed everythng I could find wether it was allowing user access, adding permissions to directories etc...

IIS 6 Http Handler with no predefined file extension

Well i have a http handler that is set up like this
<add name="DocumentHandler" verb="*" path="/LinkDocumentHandler/*" type="MyTestProject.LinkDocumentHandler, MyTestProject" />
(Remove name in IIS 6 and move it to the right section)
This works great in my VS webserver all requests that are going to the directory LinkDocumentHandler are handled by the handler..
Now when i come to IIS 6.0 this did not work so i googled a bit and found out that i have to define what file types IIS 6.0 will pass to asp.net well i can't predict all of them so that would not be so nice..
I tried to change /LinkDocumentHandler/* to /LinkDocumentHandler.aspx/* but that did not help..
So is there any way to force IIS 6.0 to pass all file requests with that sub dir to my http handler??
In IIS I added a Wildcard and unchecked "check if file exists" and it just worked (used the same dll that .aspx uses)!
This is very difficult to do in IIS 6, what you really need to do for this is write an ISAPI filter. Beyond that, IIS mappings are pretty much controlled by the file extension so it's very difficult to get it to pass all requests to asp.net.
There's a similar discussion here, where it appears the OP might have found a "partial" solution.

ASP.NET FileUpload failure

Trying to upload a large file (20MB), I set the maxRequestLength to a high enough level (and the expiration time too) in the httpRuntime entry of web.config. The Event Log stopped reporting that the post size exceeds allowed limits, but I still get the same behavior in the browser (IE or FF): "The connection to the server was reset while the page was loading." I'm using VS2008 and the built-in web server, not IIS. I've read the Q&A on this topic and even put in the check for the exception (IsMaxRequestExceededEexception) in the application global handler. This was referenced in another StackOverflow thread about this topic. Anyone had anything similar, have any ideas?
Thanks,
Bob
Not come accross this myself with the built in server, however you could try increasing the time out too in the web.config file.
<httpRuntime executionTimeout="****" maxRequestLength="****" />
Figured out my problem. I put the entry into the wrong web.config file -- I have two web apps in the same VS solution. doh!
Http uploads are notoriously unreliable. You should look into some other options that utilize Flash or Silverlight for file uploads.

What is max file upload size in IIS6.0? and how do we overcome that?

In my application, I would like to upload files of size more than 3GB. I increased max file request timeout as high as possible.
But it is not even posting the page to the server when I select a 3GB file.
My web site configuration:
Asp.Net 3.5
IIS 6.0
Is it possible with the above configuration? If not what is the reason, and how do I resolve this?
I'd probably go with a FTP approach. Using FTPWebRequest - try Google for sample code.
You'll need to adjust both the timeout and request length in your web.config appropriately:
<system.web>
<httpRuntime maxRequestLength="102400" executionTimeout="360"/>
</system.web>
Of course keep in mind, a 3Gb file is going to require a lot of patience. In reality, I suggest investigating alternatives - HTTP post is not going to be pretty with files of this size.
One possibility: http://www.banmanpro.com/support2/File_Upload_limits.asp
Unfortunately adjusting the timeout and request length is not going to work. Your web server will run out of memory before the upload completes.
What you need is a file upload control that will break your upload into smaller chunks, so that you don't use all of the server's memory to hold the file while it is uploading.
One of the better file upload controls available is Darren Johnstone's ASP.NET File Upload control. This free control is a drop-in replacement for the standard ASP.NET file upload component, and is specifically designed to handle large files. It even includes a progress bar that doesn't require Flash.
Complete documentation and installation instructions are here:
http://darrenjohnstone.net/aspnet-file-uploaddownload-module-v2-documentation/
The control (and source code) can be downloaded here:
http://darrenjohnstone.net/downloads/

How do I configure IIS to handle really large file uploads?

Platform: IIS 6, ASP.Net 2.0 (.Net 3.5), Server 2003.
I'm building an application that accepts files from a user, processes them, and returns a result. The file is uploaded using HTTP POST to an ASP.Net web form. The application is expecting some large files (hundreds of MB).
I'm using SWFUpload to accomplish the upload with a nice progress bar, but that's not contributing to the issue, because when I bypass it using a standard HTML form pointing at my upload accepter page, I get the exact same error. When using the progress bar, the upload continues to 100%, then fails. With a standard form, the behavior appears to be the same.
I'm having a problem right now uploading a file that's about 150MB. I've changed every settings I can find, but still no luck.
Here's a summary of what I've changed so far:
In Web.config:
Added this inside system.web:
<httpRuntime executionTimeout="3600" maxRequestLength="1536000"/>
In machine.config:
Inside system.web, changed:
<processModel autoConfig="true" />
to:
<processModel autoConfig="true" responseDeadlockInterval="00:30:00" responseRestartDeadlockInterval="00:30:00" />
and in MetaBase.xml:
Changed:
AspMaxRequestEntityAllowed="204800"
to:
AspMaxRequestEntityAllowed="200000000"
When the upload fails, I get a 404 error from IIS. My web form does not begin processing, or at least, it doesn't make it to the Page_Load event. I threw an exception at the beginning of that handler, and it doesn't execute at all on large files.
Everything works fine with smaller files (I've tested up to about 5.5MB). I'm not exactly sure what file size is the limit, but I know that my limit needs to be higher than 150MB, since this is not the largest file that the client will need to upload.
Can anyone help?
Urlscan was active on all websites, and has it's own request entity length limit. I wasn't aware that Urlscan was running on our server because it was a global ISAPI filter, not running on my individual website.
Note: to locate global ISAPI filters, right click on the Web Sites folder in IIS Admin and click Properties, then on the ISAPI Filters tab.
(A note for googlers):
For IIS7 add below to web.config (I added above <system.serviceModel>):
<system.webServer>
<security>
<requestFiltering><requestLimits maxAllowedContentLength="262144000" /></requestFiltering> <!-- maxAllowedContentLength is in bytes. Defaults to 30,000,000 -->
</security>
</system.webServer>
When we ran into this issue we had to increase the buffer size limit according to this KB article:
http://support.microsoft.com/kb/944886/en-us
I know this mentions ASP, but I believe it worked for ASP.NET as well.
Edit: Here is a link that might be more relevant to your issue and provide other options:
http://weblogs.asp.net/jgalloway/archive/2008/01/08/large-file-uploads-in-asp-net.aspx
404 and missing Page_Load: IIS can only process the request once the complete POST is on the server. Therefore, if the POST fails (due to its size), it cannot fire the page's events.
You might try NeatUpload http://www.brettle.com/neatupload.
From the Manual: "By default, NeatUpload does not directly limit the size of uploads."
You can also try Velodoc XP Edition which has several advantages over NeatUpload including the fact that it uses ASP.NET Ajax extensions. See also the Velodoc web site for more information.
You say:
But 1536000 is only 1.5MB?

Resources