MVC: "Incoming request does not match any route." - with default request

I get this error only SOMETIMES (apparently by accident, although I know that this does not happen on computers at all).

I am working on an MVC site (release 1) in VS 2008. The machine is running Windows 7 with IIS 7, but this instance is running a web server built into VS (Cassini?). When I run F5, I sometimes get an exception trap on the 4th line of the default Page_Load method .aspx.cs:

httpHandler.ProcessRequest(HttpContext.Current);

Exclusion method: Incoming request does not match any routes.

Examining the object HttpContext.Current.Requestshows the path to "/" and rawUrl from "/Default.aspx?" - i.e. Your usual empty site request.

The MapRoutes procedure is pretty standard, with the exception of a couple of lines of IgnoreRoutes (ignore "pics / {* imgfile}" and ignore "{* favicon}"). The Application_Start procedure has a configuration for StructureMap and a call to SetControllerFactory before calling RegisterRoutes, but otherwise it is standard.

Usually, if I restart VS, the problem will disappear. (And almost always if I reboot the machine).

Any clues?

Thanks.

+3
source share
2 answers

. F5 asp.net . , MVC View , , . .

+1

, ...

! Application_Start, , Global.asax!!

vb.net:

Sub Application_Start()
    RegisterRoutes(RouteTable.Routes)
End Sub

global.asax,

0

Source: https://habr.com/ru/post/1719907/


All Articles