For some reason, my ASP.NET web application returns error 500 (apparently originating from handler "ExtensionlessUrlHandler-Integrated-4.0") when a non-existing route is accessed.
This issue has started to occur after I had changed path="*."
to path="*"
in the <add name="ExtensionlessUrlHandler-Integrated-4.0" ...
line of my Web.config
file in order to solve another problem (failure to process routes with a dot after the last slash).
I cannot change path
back to "*."
, even though exactly that is suggested as a solution in another question, because that will bring back the other problem - routes with a dot in the part after the last slash are not found anymore.
Like in that linked other question, I am using OData. However, I am not aware that it should play any role in route resolution in my case at all, because I think we treat it just as an ordinary library that is referenced in our C# projects and invoked by a few of our web API endpoints.
<modules runAllManagedModulesForAllRequests="true"/>
is already set in my Web.config
file.
What else can I do so 404 is returned for unknown routes and "extension-ful" routes (i.e. routes whose last part after the last slash contains a dot) are accepted?
EDIT: I have managed to increase my FREB log size and now see that the offending entry is number 1346, saying
ModuleName="ManagedPipelineHandler", Notification="EXECUTE_REQUEST_HANDLER", HttpStatus="500", HttpReason="Internal Server Error", HttpSubStatus="0", ErrorCode="Rekursion zu tief, Stapelüberlauf.
(0x800703e9)", ConfigExceptionInfo=""
In English, the error message means: "Recursion too deep, stack overflow."
Therefore, it appears to be the same issue as in another question, however, the answers from there do not help in my case:
- Philip suggests to remove various handlers, which doesn't change anything for me.
- Joe Davis suggests the solution with the
"*."
path, which works, but causes the other problem, as described above.
Both answers refer to the <handlers>
section in my Web.config
file, which currently looks like this:
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
<remove name="OPTIONSVerbHandler"/>
<remove name="TRACEVerbHandler"/>
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*" verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/>
</handlers>
See Question&Answers more detail:
os