Url smaller than 2 tokens Error - castle-monorail

I'm getting this awkward and embarrassing and somewhat heinous (sp?) and egregious error within MonoRail intermittently. When users go to the homepage of the site they get the error:
Url smaller than 2 tokens
Usually after 5-15 minutes the error will stop but it comes back regularly. It only happens on the homepage because it is the domainname.com and it doesn't throw this exception if the url has a subdirectory. It's the silliest Monorail error ever, as why would you want to throw an error if someone is on the homepage of your site?
Anyway, here is the route rule that supposedly should take care of this issue but does not:
RoutingModuleEx.Engine.Add(
new PatternRoute("Home", "/[controller]")
.DefaultForArea().IsEmpty
.DefaultForController().Is("Home")
.DefaultForAction().Is("Index")
);
Any ideas? I'm hoping the Monorail gurus can help me out.

I use a Default.aspx file for IIS to catch, and then in web.config or global.asax, urlrewrite it to my home page action. This always works for me.

Related

Client-side error monitoring that catches 404s and other script / resource errors?

I've been looking into New Relic, BugSnag, and a few others, but no one seems to be catching 404 errors in their client-side monitoring. For example, say I have the following script tag in a given page:
<script src="//cdn.example.com/app.js1445291270"></script>
with the minor but critical typo of missing a ? after .js.
This of course returns a 404 and the script never loads.
Are there any services that would catch client-side errors like this?
You should be able to do this with Bugsnag. You can detect whether the status= 404, and use Bugsnag.notifyException() to send the error in. Hope this helps!
TrackJS error monitoring supports this use case. Here is how to add monitoring for resource loading failures.

How to debug a 404 error on apache server ( lamp )?

I came across 404 error a few times and i have difficulties in debugging this kind of problem.
What is the strategy and tools available to analyse such problems (firebug, logs...).
How to differentiate and fix the cause ?
page not existing ,wrong path , redirection and rewriting ,server problem ...
404 error code means that a file is not found for whatever reason.
Just check that the file exists and that the path you use is right.
You can analyse sent requests and received responses headers and body in your browser's developper console if you want more details about why some request failed.

how to log errors in iis7.5 and MVC4?

I have written an application using MVC4.
After I depolyed it to production, I noticed I get the errors
server could not process you request
from time to time. Its not function related as if I do the same action as before the system works no errors. So I want to find more information about what is causing the issue
how do I log errors in iis 7.5? where should I be looking?
I looked at C:\inetpub\logs\LogFiles\W3SVC2 which is where logging is occuring in my application through iis, but I went through the files and could not see anything that looked like an error..
is there something in particular I should be looking for?
Thanks

405 (POST not allowed) HttpException when trying to apply HttpResponse.Filter

We are getting a 405 error and the following exception from IIS7 when attempting to apply a ResponseStreamFilter to HttpResponse.Filter:
HttpException:
The HTTP verb POST used to access path '/app/Thing.asmx/Command' is not allowed.
We are applying the filter by using an HttpModule with code like this:
var rfs = new ResponseFilterStream(HttpContext.Current.Response.Filter);
rfs.TransformStream +=
new Func<System.IO.MemoryStream, System.IO.MemoryStream>(ProcessStream);
HttpContext.Current.Response.Filter = rfs;
Log("Response stream filter applied correctly.");
All of the code in our HttpModule works just fine... it's all wrapped in a try-catch just to be safe and isn't throwing any exceptions, and diagnostic logging like the last line above is working correctly.
But it looks like our ProcessStream method in the above code is never being called. If we apply the filter to HttpResponse.Filter at all, IIS throws the 405 exception before our filter begins processing.
Our code has worked before on several similar systems, so we suspect IIS/machine configuration on this specific server is responsible. What could be causing this?
The most commonly reported cause for a 405 error in a situation like this seems to be using Url.Rewrite. (The HTTP verb POST used to access path '/test.html' is not allowed) However, we are never using a Url.Rewrite.
Another commonly reported cause is trailing slashes in the request URL. (HTTP 405 on Error on HTTP POST IIS ASP .NET) But as mentioned above, the URL being requested does not end with a slash.
The app pool is running .NET 4.0 in a Classic pipeline (jQuery AJAX post receives 405 error (HTTP verb POST not allowed)), but our code has run without issue on many other systems under a Classic app pool, so there would still have to be something unique to this server's configuration. Changing to Integrated pipeline breaks the application our code is filtering, so that's not a possible workaround anyway.
Turns out, it was a very obscure IIS bug:
http://support.microsoft.com/kb/980368
The ExtensionlessUrl handler (*.) was incorrectly getting involved with the request instead of just the WebServiceHandlerFactory (*.asmx) as expected. The workaround was:
Manually deleting the ExtensionlessUrl handler entries from the web application's handler mappings
Manually moving the ExtensionlessUrl handler entries under anything you actually expect to be hit
Adding a web.config entry under system.webServer/handlers to remove the ExtensionslessUrl handler as needed (we went with this option to make sure it got included with app demployment)
We had to burn a Microsoft support ticket on this one, since there's no way we would have figured this out in any reasonable timeframe. Hopefully this helps someone else.

Weird 404 error in application.log and getting YII to ignore them?

Something is access my site using this URL:
/(Yvax:%20uggc:/jjj.tbbtyr-nanylgvpf.pbz/hepuva.wf)uggc:/jjj.tbbtyr-nanylgvpf.pbz/hepuva.wf
So I get error:
[error] [exception.CHttpException.404] exception 'CHttpException'
Is it something to worry about?
How can I stop YII from reporting on this specific error and other similar 404 errors that are unwanted?
Probably just a scanner script. We get hit by these all the time. Review security, but as long as that checks out you should be fine.