Uploading a large file via Nancy ends in a 404 - asp.net

I'm experimenting with using Nancy framework and found it works quite simply and I got the methods for downloading & uploading files quickly. I even was able to download large files with no problem with no changes.
However, I am finding that when I upload a large file, I get a 404 error; Nancy's route is never reached nor does it shows in request tracing.
The same route works fine when I use a small file so I have to think there is something going below Nancy that prevents me from posting a large file. From past experience with WCF, it was necessary to set several parameters and I assumed most would not be even applicable in a Nancy framework, neither would I have any idea how to translate what I should do in WCF to what I should do in Nancy.

During typing up the question, I noticed a similar question here; ASP.Net 404 Large XMLHttpRequest File Upload
From there, I derived that I needed to update my web.config in two places:
system.webServer/security/requestFiltering/requestLimit
system.web/httpRuntime/#maxRequestLength
With those 2 changes, the 404 turns into 200. So simple!

Related

Manually added WebResource.axd - Any security implications?

I added WebResource.axd (empty file) manually in production environment (IIS7 and Windows Server 2008) after chrome and firefox was giving error 404 for WebResource.axd. And now it is working fine, even with parameters. I am not sure why ASP.NET generating this script in final render result (no problem with VS2008), but now it is working. I want to know, is there any security implications other than what normally associated with WebResource.axd as it is in root directory?
Thanks
I also had this issue recently, after a code change WebResource.axd stopped working for my site. Basically, it exposes dynamic resources over http. For a longer explanation visit:
Just where is webresource.axd?
Typically, what happens is that one of the dynamic resources being requested has failed, but the resource name is encrypted. This blog post will help you decrypt the name, use it and the query string of your failing webresource.axd?___ request to figure out where the error is coming from.
Telerik webresource troubleshooting

Blank WebResource.axd

Have a rather large problem. About two weeks ago I noticed that alert based validation (ValidationSummary) stopped working on my website. Upon further review, WebResource.axd is coming back blank. It's not throwing an error, just blank.
I've tried tracing the request via Fiddler and Firebug, and the response is 200 at first. Subsequent cached requests (same page) return 304 (as I would expect).
I've checked IIS configuration, web.config, installed updates, Global.asax, httpHandlers etc... to try to find out what happened or why it's failing.
I've been troubleshooting this issue for two days now and am running out of options. Does anyone have any idea what the cause of this could be? Any help is greatly appreciated.
This appears to be a tricky issue, can you check and answer the following two questions:
By any chance is debugging enabled on your deployed site.
Was the deployed website build properly in release mode?
I found the issue. Whilst installing John Papa's Hot Towel MVC project into a web forms/MVC hybrid, the routing config does not contain an IgnoreRoute instruction for AXD paths.
This means routing picks up the request ahead of the HttpHandler, and returns a 200 even when no controller exists for the given route pattern - hence a 200 response with an empty body.
I'll pull the bounty but I will upvote Shashank's answer.

Uploading large files with Brettle Neatupload, but found a possible Intelligencia.UrlRewriter conflict?

I have been working on a project which requires large files to be uploaded (high res images, and videos etc). Windows website on IIS6 and dev on IIS7.
I am used to using Intelligencia.UrlRewriter for URL rewriting and this has worked brilliantly for me in on other projects.
I created a small test website to test NeatUpload and this worked really well, and once I'd figured out how to add some jQuery and more interesting formatting worked well.
However, once I copied the new code into the real web site the page failed with a HTTP Error:
HTTP Error 404.13 - Not Found
The request filtering module is configured to deny a request that exceeds the request content length.
I read the manual and tried the suggested fixes to I did not get any joy.
Has anyone come across this conflict before, or found a work around or solution?
Or if it is a non-starter, are there any other (non-flash) based 3rd party solutions I can use for uploading large files? I have wasted 3 days so far and I am starting to lose patience. :-(
Cheers
Toby
This link has the solution to the problem:
http://deepeshsomani.wordpress.com/2011/08/16/how-to-resolve-file-size-error-for-files-whose-size-is-larger-than-specified-in-web-config/
Faced the same issue and resolved it using the same approach after a week spent like hell for a solution.

ASP.NET showing 404 for some .aspx files even though they exist

I just redeployed one of my sites today and suddenly some (but not all) of my .aspx files are redirecting to my 404 handler.
I've scrutinized the security settings on the offending files, comparing them line-by-line with other .aspx files that are serving correctly, with no luck.
The files 404'ing files were indeed ones I had been working on, and were replaced during the deploy. But then again, some of the other files I was working on are coming up fine. Naturally, the changes were not the sort of thing that would cause the errors I'm seeing, and the site runs perfectly in my dev environment.
Any idea what could be causing this?
ANSWER: User Error (as always)
Looks like my deploy script was skipping .ascx files. (One of the minor changes between last deploy and this one was adding a couple usercontrols.) The page would start loading, look for its UserControls, not find them, and throw a 404.
Thanks all for the sympathy. Sorry to waste your time. Hopefully this will at least help the next guy who fat-fingers a deploy script and gets a non-helpful error message.
Maybe you've already done this, but as you stated you had been recently working on those files, I would start by verifying that the links to the offending pages are correct in the source - check that their declared path is (works out to be) indeed valid. I try and make all links relative with Server.MapPath or something similar, but occasionally one slips my mind.

Getting data into flex charts from csv

I am developing a flex charting web application which gets data from csv files. This application is supposed to be installed on the website of a client. The client uses a web server management system where the URLs generated are pretty long and contain non-alphanumeric characters. An example is given below:
http://www.example.com/EXTERNAL/ORGANIZATION/0,,contentMDK:20135608~pagePK:64060242~piPK:64060289~theSitePK:299948,00.html
The problem is that on my test server, the application is running just fine. But when deployed on the client's site, the application and the charts load, but the CSV data fails to load. The error given is:
Input output error: IO_ERROR
I have tried both relative referencing (relative with respect to the swf file) and absolute reference to the URL of the csv file. But both approaches have failed.
Any ideas?
I would ideally like to stay away from absolute URLs since that would break down if the charts need to move to another location.
Thanks
Vinayak
Umm, I don't know what to say really. Not knowing much about the server I'll have to resort to a list of things I can think of. Some of these are admittedly just a stab in the dark. In general it appears that this is a server side issue and as a front end developer you can't be expected to solve this. I know that getting the application to work is the priority here, but if you don't have access to the server there not much you can do to this issue.
First let's eliminate the completely obvious. Is the file ending definitely supposed to be .html and not .csv?
My original thought was that the CMS is somehow blocking Flash from loading the content, but would allow a browser to access it. Since it won't allow that either there are three options that come to mind:
1) The server or the browser does something to the URL when you make the request. Try installing the LiveHTTPHeaders (link) add on for Firefox, that'll allow you to look at the raw HTTP requests and responses. There might be some server side redirects that affect the request. The HTTP Headers should help you with that too.
2) The .csv files are kept in a folder that the web server doesn't have read access to.
3) maybe you need to use HTTPS instead of HTTP. This would be a bit strange since you are getting the URL from the server in the first place. The clients server admin should be able to sort this out for you.
4) I'm not sure what would happen if the script that handles your request is Python. In Python the colons are directory separators, so that might throw the whole thing off.
5) The clients management system does something strange to the URL before it's handed to you. Although I'm not sure how you would test this.
That's it I think. I'm out of ideas for now. For the testing I would forget the flex application and just try the requests from the browser address bar first. Since the application is working on your test server the issue shouldn't be your code. When you get the requests to work on the browser, if they still don't work from Flex then it's your code.
I don't know how much it helps, but there is an as3 CSVLib available.
About the IOError, can you please paste the text ?
If you listen for the IOErrorEvent and trace event.text in the handler,
you should something similar to this:
Error #2035: URL Not Found. URL: yourFile.csv
HTH,
George

Resources