My project was built with MVC3 Razor. And, recently I applied Ssl and Sitemap (mvcsitemap) regulation on this project. Then, last two days I get exception like these. But, these pages or method does not take part in my project. (Also, there is no such word). I think that is because from sitemap. But, I'm not sure. Why can be caused these errors?
System.Web.HttpException (0x80004005): A public action method 'dummy.aspx' was not found on controller 'Test.Controllers.HomeController'......
System.Web.HttpException (0x80004005): A public action method 'cgi-bin' was not found on controller 'Test.Controllers.HomeController'......
thanks in advance.
Related
Assalamu alaykum. I did an API controller. When I run in the visual studio and query, the swagger returns 500 errors, but when I debug it doesn't reach the controller action.
This is why and how to fix it?
I also create a simple, no parameter, just a test endpoint that simply returns an int variable. Any method inside this controller file is not reached when this controller's endpoints are queried.
By the way, this is a .NET framework application.
Knowing brothers #help
I found why this happened. It is because the service used in controller is not registered in DI container. In my opinion, it should just throw an exception instead of returning 500 without reaching to controller action. Anyway, I don't know why, but this worked for me after I added the service to DI.
I actually forgot about this question of mine. But, anyway, there may be something useful for someone in this answer.
I found the answer: If there is some kind a service which is not registered in Dependency Injection, then there will be 500 error in swagger - for any request. Any call will be faced with thrown exception before reaching the controller.
I am getting an error with my asp.net core 2.1 MVC project template. It looks like _Layoutlogin .cshtml is not able find. File is there in the shared folder and the only thing is that in the error message before .chmtl there is space at the end. This is happening after scaffolding idenitity
An unhandled exception occurred while processing the request.
InvalidOperationException: The layout view '~/Views/Shared/_Layoutlogin .cshtml' could not be located. The following locations were searched:
~/Views/Shared/_Layoutlogin .cshtml
Microsoft.AspNetCore.Mvc.Razor.RazorView.GetLayoutPage(ViewContext context, string executingFilePath, string layoutPath)
I suspect you have a typo some place if you check _Layoutlogin .cshtml there is a space in their so if in fact your file is _Layoutlogin.cshtml its not going to find it.
I have a Web API project along with the built in help website. When I start up the project locally, the help website home page displays no problem. But when I send a REST POST request to an API controller using fiddler, I get the following response.
The following errors occurred while attempting to load the app.
- No assembly found containing an OwinStartupAttribute.
- No assembly found containing a Startup or [AssemblyName].Startup class.
To disable OWIN startup discovery, add the appSetting owin:AutomaticAppStartup with a value of "false" in your web.config.
To specify the OWIN startup Assembly, Class, or Method, add the appSetting owin:AppStartup with the fully qualified startup class or configuration method name in your web.config.
I have tried to solve using the suggestions in the error message but no joy.
It works OK on the test server.
Can anyone suggest why this error is returned only on a REST request and not when the help website starts up and any tips on how to solve?
Is there a way to redirect the user to an error page (view) when an exception is raised in application_start method of global.asax? I get a Request object is null message when I try to do a redirect. How would i handle this? I have to raise the exception if certain conditions are not met and I want the user to go to a specific View.
My application is MVC3 based, btw.
Thanks
Application_Start happens before ASP.Net starts processing the request.
You could set a global static flag to indicate the error condition, then handle BeginRequest and check the flag and redirect.
You can refer this page.
The thing you are trying to do is possible via Web.config Just show what page to load when http error 500 occurs.
Edit
Sorry gave wrong url
I have an MVC3 project using nHibernate, Rhino and Castle. I finally got all of the components in place. I think. At least it runs and invokes the IWondsorContainer CreateContainer() method....after that method, the Application_Start does not fire and I get the message:
Server Error in '/' Application.
--------------------------------------------------------------------------------
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /Views/Proposal/Index.cshtml
Any ideas? I don't know what to make of this. Thanks
You seem to be requesting a view directly: /Views/Proposal/Index.cshtml. In ASP.NET MVC you do not request a view. You request a controller action. So in your browser the url should be /Proposal/Index or simply / depending on how your routes are configured.
I suspect that you had the focus on this Index.cshtml when you hit F5 in Visual Studio which has this ugly habit of following the url. You could define a start url in the properties of your web project to avoid this behavior.