IIS7 MVC deploy - 404 not found on some actions - model-view-controller

Once deployed parts of my web-application stop working. Index-es on each controller do work, and one form posting via Ajax, Login works too. Other then that yields 404. I understand that nothing particular should be done in integrated mode.
I don't know how to proceed with troubleshooting.
Some info:
App is using default app pool set to integrated mode.
WebApp is done in net framework 3.5.
I use default routing model.
OS is Windows Server 2008.
IIS 7
Any help is appreciated. Thx.
EDIT:
I determined that only actions that accept ID parameter don't work. On the contrary, when I add dummy id method in Home controller of default MVC app it works.
EDIT 2:
I found the problem. Links on few pages of the site didn't use ActionLink helper. It was harder to see because of the Ajax invoking. So, never hardcode links to the actions on the site, even temporary.

Please go through this link for details on deploying MVC application with IIS 7 integrated mode.
http://www.asp.net/mvc/tutorials/older-versions/deployment/using-asp-net-mvc-with-different-versions-of-iis-cs

Related

Ajax not working with laravel project deployment

I know this might be a broad question but i recently finished developing a laravel 5.6 app. I deployed it to a free hosting service (000webhosting) because i wanted the client to be able to preview it remotely from where they are without having to sign up for domains and hosting accounts and all that jazz.
I uploaded it by zipping my project folder and putting it in the directory of the cpanel. I put all the public files (including .htaccess) into the public_html folder and put the rest of the project into the parent directory.
Long story short, everything works fine except for ajax. Other non-ajax CRUD is functional but nothing ajax related works. It all produces 404 errors. The other non-ajax functionalities are in the same controller as the ajax methods! so i know the project is talking to itself. I have jquery library linked to on the hosted google libraries page. Is there some sort of convention that i'm missing that is limiting this functionality? do some web servers block ajax requests? It's working perfectly in my localhost wamp environment. What could i possibly look into to resolve this ajax discrepancy? If it comes to it, i'll pay for hosting, but i just want to make sure this isn't a consistent topic with many host providers where ajax needs to be specially configured or something.
github.com/maximus1127/drive ....this is the github repo. the file in question is drive/resources/views/auditor_pages/application_review.blade.php.
To login the browser, go to https://makemedrive.000webhostapp.com/ login with "aa#aa.com" pw "password". Click the instructors tab on the left, then instructor application, then view details. The "save notes", "background check/received" buttons are all the ajax features of this page and none of them work. They all produce 404 errors. Please help!
Thanks in advance!

Postback Not Working at Application Root [ASP.NET 4.0]

I have a number of virtual applications under one site, all of which have the same issue. Whenever you are at the root of the application (~/) postbacks do not fire, the page just refreshes.
Here are some samples (all their own virtual applications):
Clicking on "Login" link does not redirect to Login.aspx page
http://designbyssi.com/designbyssi.com/projects/air-savings/02/
http://www.designbyssi.com/designbyssi.com/projects/life-furniture/06/
Entering username / password, and then clicking "login" / "go" does not log a user in
http://designbyssi.com/designbyssi.com/support/
http://www.designbyssi.com/
For some reason, if you add "Default.aspx" to the end of any of the pages above the postback works as expected (eg. http://designbyssi.com/designbyssi.com/projects/air-savings/02/Default.aspx). I've been Googling this for a while now and I found a few articles, though none of them have helped.
Here are the articles I've managed to find:
Why won't postbacks work on my domain root?
http://forums.asp.net/t/1735380.aspx/1
http://forums.asp.net/t/1482960.aspx
I'm not using any type of URL rewriting, they are all web form applications, and I'm on a Godaddy shared hosting account.
Any ideas on what might be happening, or what I need to do to fix it?
I had the same issue recently where my dev environment was setup in integrated mode while production was in classic mode. Postbacks in dev were not working when going to the root of the site but would work when going to Default.aspx.
I simply changed my dev environment to use classic mode for now. Also, this problem does not necessarily have anything to do with URL rewriting.
Since you are on shared hosting, you probably can't do that but these links may help.
Postback doesn't work with aspx page as Default Document
Event Handlers Might Not Be Not Raised in a Default Document in IIS 7 or IIS 7.5 Integrated Mode?

Blank page on Azure

I have an application running in Azure (trial account). So far so good, everything has been nice, except for a long deploy times (10-15 minutes).
I've done a deploy recently and got a lot of weird bugs I cannot trace. For example, if I log in and thus a cookie is created (I use FormsAuthentication) all I get from the application is a blank page, as in, absolutely nothing is sent to the browser. The application works fine in the ASP.NET Web Dev Server, IIS Express, even the Azure Emulator!
What could be the issue? Searching the web hasn't been much help, with only a couple of unrelated issues.
I tried logging into the site (if I correctly understood from one if the comments, the url is versulo.com) and I didn't get any blank page with 404 status code.
However, there is another problem I spotted. Your site seems to be implementing caching inappropriately. The main page, the one from which you trigger the login and which is dynamic in nature contains an Expires header set at 5 minutes after the pages first load. That means that each call or redirect to that page within 5 minutes since it was first loaded, will be served from the browser's cache.
Because of that, after I login into your application I am redirected back to the home page which looks like I am not logged in. If I force a F5 refresh on the browser, then the page will indeed show me as logged in.
If instead of a refresh I try to login again (which is what I did in my first trials, since it looked like the login didn't work in the first time), I am getting an error page with the following message:
Sorry, there has been an error on the server.
500
The page looks like an application error page and even if it displays the 500 number, it is actually served with an HTTP 200.
So, while I am not 100% sure if this is also the cause of the problem described by you, you should remove the Expires headers from the dynamic pages your application is serving.
This can be because you're combining Forms Authentication with multiple instances. Are you using multiple instances? If that's the case, could you:
Try to change it to 1 instance. Does this fix the issue?
Try to make the following change to the web.config (configure machineKey): http://msdn.microsoft.com/en-us/library/ff649308.aspx
some partial views are not rendered at all;
Do you mean some pages are working fine, but others are not? It would be better if you can point out a pattern on what’s working and what’s not? For now, please make sure all referenced assemblies (except for default .NET assemblies and Windows Azure runtime) have Copy Local set to true. For example, MVC assemblies are considered as extensions to .NET, so please set Copy Local to true. In addition, you can also try to use Fiddler to monitor the requests to see what’s returned from the server.
Best Regards,
Ming Xu.
Could you provide a link to the application, or perhaps some source code?
When you say 'blank page', what is actually returned, a 404 / 500?
Have you inspected the IIS logs, or added some trace information to your code?
Have you tried accessing the service using it's ip address rather than domain name?

Problems with default Razor View when deploying to "real" IIs Web Site

I have this ASP.NET MVC 3 application that works fine when developing locally using IIs Express 7.5 or Cassini.
But when i deploy the app to a real web site on IIs 7.5 (even on my local dev box) I get the dreaded
The view 'Index' or its master was not found or no view engine supports
the searched locations.
The following
locations were searched:
~/Views/Home/Index.cshtml
~/Views/Home/Index.vbhtml
~/Views/Shared/Index.cshtml
~/Views/Shared/Index.vbhtml
I have tried the following:
In global.asax.cs, added these lines in the Application_Start() method to force it to use the Razor view engine only:
ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new RazorViewEngine());
But to no avail.
I find this error message somewhat difficult to troubleshoot. Can someone give me some pointers on what to look for?
Ok, my bad.
A classic example of shooting first then ask. (Or the other way around...)
The Home/Index.cshtml file had its Build Actions set to None for some reason. Setting it to Content solved the problem.

How can I mix Forms Authentication and Windows Authentication in MVC 2 in IIS 7.5?

I've seen this posted alot that solves the problem if you are running ASP.Net application not a MVC 2 one in IIS 7.5. Would the same solution work using location in the web.config and 2 seperate login pages like it does for asp.net? Do you need to register a new route to do that?
I know it would work with 2 seperate applications in IIS, but i want them all in the same application. Any ideas?
Solutions for asp.net
http://mvolo.com/blogs/serverside/archive/2008/02/11/IIS-7.0-Two_2D00_Level-Authentication-with-Forms-Authentication-and-Windows-Authentication.aspx
Mixing Forms authentication with Windows authentication
http://craigandera.blogspot.com/2004/07/mixing-forms-and-windows-authentication_24.html
It looks like you can use the following solution.
http://mvolo.com/blogs/serverside/archive/2008/02/11/IIS-7.0-Two_2D00_Level-Authentication-with-Forms-Authentication-and-Windows-Authentication.aspx
But i had to create a ASP.net page inside my MVC solution that gets hit directly to handle the Windows Authentication then redirects to the mvc site. The location section inside of the web.config should work then since it's not relying on the routing.

Resources