IIS 10 (or MVC?) throwing 403 Forbidden [duplicate] - asp.net-mvc

I have deployed an asp.net MVC application to my IIS7 server. When I attempt to browse the dafault route I get the message
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
It's clear to me that it is not loading/processing the global.asax, but I have no idea why. I've deployed another MVC application to this same location/app pool and it works fine.
Does anyone have any idea how to debug a problem like this?

Maybe:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
OR
ASP.NET MVC on IIS 7.5
ASP MVC in IIS 7 results in: HTTP Error 403.14 - Forbidden
Can't run ASP.NET MVC 2 web app on IIS 7.5

I've tried a lot, and finally one checkbox did the trick

Related

IIS overriding handling of 404 and 500 http status codes in MVC

I'm using MVC 4 with IIS 7.5. I'm trying to handle 404, 500 and other codes with my own controller and view.
However, no matter what I try, IIS overrides my settings/code and injects it's own 404 (and so on) error pages. This happens locally on dev machine with IIS Express as well as production with IIS 7.5.
Here's a combination of all I've tried so far:
Used tag in web.config with redirect to my custom error view, no luck.
Provided custom error handling in Global.asax. It gets there (tried 404 and 500), it does call my custom controller and view, but at the end, IIS still wins and shows its page instead of my view.
By the way, I'm trying this will extensionless url as well as .html pages. How can I get IIS to leave it alone and allow MVC to take care of these errors.
I"m out of options at this point. Any advice would be appreciated.
You need to override how IIS handles the error status codes. This can be done by simply modifying the <system.webServer> section in your web.config.
<httpErrors existingResponse="PassThrough" />
Full information can be found on the IIS.NET site: http://www.iis.net/configreference/system.webserver/httperrors

ASP.NET MVC Sub Application

I have a ASP.NET MVC application at a root level (e.g. http://example.com), and have now deployed an additional ASP.NET MVC application as a sub-application (e.g. http://example.com/api). I have set the sub-application as an "Application" in IIS.
However, whenever I try to navigate to the sub-application, I am getting a 403.14 Forbidden error. It's like the sub-application isn't getting picked up as an ASP.NET MVC application. If I try and hit a url which has a controller/action method in the sub-application (e.g. http://example.com/api/home/index"), I get a 404 response.
In terms of setup, the only differences I can see in IIS Manager is a lack of an "ISAPI Filters" icon for the sub-application. I am running .NET 4.5, ASP.NET MVC 4, and IIS 7.5.
Does anyone have any suggestions on how to get this ASP.NET MVC sub-application working?
Turns out I was missing the following config from the <system.webServer> config in my child application:
<modules runAllManagedModulesForAllRequests="true"/>
After I put that in, it started recognising the child application as an ASP.NET MVC site.

ASP MVC Forms Authentication Working Locally Not IIS 7 - 401 Unauthorized Error

I have a asp mvc 2 web application that with forms authentication. It is working just fine on my Visual Studio Development Server but once I deploy my application to IIS 7 it give me a
'401 - Unauthorized: Access is denied due to invalid credentials' error without going to my loginURL page.
In my Web Config
<authentication mode="Forms"
forms name=".MYUNIQUFORMSAUTH" loginUrl="/Login" requireSSL="false" timeout="20000" />
<authentication/>
In IIS i also set the authentication to be Forms on my project and the cookie name matches name set in web.config file.
Project application pool is set to .NET 2.0 with Integrated Pipeline.
I had this problem and it was because the layout page had an Html.RenderAction to a controller that I hadn't applied an [AllowAnonymous] attribute to.
IIS Express let this slip through. IIS 7.0 was less forgiving.
(I'm following this pattern: http://blogs.msdn.com/b/rickandy/archive/2011/05/02/securing-your-asp-net-mvc-3-application.aspx)
I believe you need to enable the Anonymous Authentication in IIS besides Forms Authentication, so that a login form can be shown.
You will need to either grant read permissions on the directory of your project directory for "IIS_IUSRS" or adjust your website in IIS to use pass through acccess scheme...
p.s.below link for more info on this
http://learn.iis.net/page.aspx/140/understanding-built-in-user-and-group-accounts-in-iis/

ASP.NET MVC and HTTP 401.0 - Unauthorized

I deployed my ASP.NET MVC application to my local IIS (same computer) and I'm getting
HTTP 401.0 - Unauthorized
after accessing the application through the browser.
I'm using forms authetication and on the development server it works fine.
I depolyed also a default ASP.NET MVC project and its working fine, so it must be something application related. Is there any way to get more information on this particular error ? Any log file or something. The message HTTP 401.0 - Unauthorized isn't realy helpful.
Tested on
Windows 7,IIS 7.5 and Windows Server 2008 R2 IIS 7.5
EDIT
Found some logs c:\inetpub\logs\LogFiles\W3SVC1\ but there wasn't anything.
Looks like you need to set permissions on the folder.
Try granting permissions to the IIS APPPOOL\YourPoolUserNameHere
or to the IIS_IUSRS user group if the first one doesn't do the trick.

ASP.net MVC deployment to IIS7

I'm trying to deploy a MVC application to a news Server, I have .net framework 4 and ASP.net MVC2 installed. My app pool is assigned to .net 4, integrated mode. But for some reason, the routing is not happening properly. I am getting a 404 error on links and not properly routed to the controller. What am i missing here? Is it might be order of installation of .net framework and IIS?
Your app is probably compiled against .Net Framework Version 2.0. Change your app pool to 2.0 and see if it helps.
Try this :
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
Or try to debug routing
So, if you got a 404 error that is because the global.asax is not being executed.
Check out if the IIS is configured to "Check if the Directory/File exists", cause the IIS is default configured to check first if the request exists on the server ... MVC doesn't use the 'real' path, per se.
Hope it helps ;)
EDIT
Try to log something at the time the routing is working ... I mean when the Route inside the global asax is called and check out if the mapping is called...

Resources