28

I know this has been answered a few times but none of the solutions worked for me. I published my ASP.NET MVC 3 application (It was just the internet template without any changes to it) to see if I could get it to work publically. However, when I visit the site it shows up with a 403 error. Coming from a php/linux background, I'm confused and have no clue where to look. I've only been learning .NET for about 8-9 months and everything I've been testing on before was on the local development server through VS2010. It almost appears like the server doesnt know it should be an MVC application or I have to change my routing.

Anyway, I checked to make sure that the server setting is .NET 4. Any help would be greatly appreciated.

ALSO, It's a shared hosting environment using arvixe.

Anonymous
  • 1,978
  • 2
  • 28
  • 37

7 Answers7

56

For me this did the trick (Original Answer by Mmerrell at Getting 404.0 error for ASP.NET MVC 3 app on IIS 7.0 / Windows Server 2008 )

You actually just reminded me that I needed to fix this issue in an enviroment here. If your situation is the same as mine then it's a simple fix.

Just add the following to your web config:

<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true" /> 

Make sure your have choosen the "ASP.Net 4.0" App-Pool and not the App-Pool created for your application. Make sure your App Pool uses the "ApplicationPoolIdentity" and NOT NetworkService. Remove the NetworkService permission from your root folder. You dont need it. IIS has an built-in identity (IIS_IUSRS).

Community
  • 1
  • 1
Robert
  • 724
  • 5
  • 7
4

403 is a forbidden error. Try checking the NTFS permissions of the folder where you deployed, ensure the Network Service user has read permission

enter image description here

Additionally, check the Authentication and Authorization mechanism in the IIS application:

enter image description here

Edited:

.Net Authorization rules

enter image description here

Jupaol
  • 21,107
  • 8
  • 68
  • 100
  • since its in the root, would I just check wwwroot? – Anonymous Jun 15 '12 at 00:32
  • wwwroot?? you need to create an application in IIS in order to execute an ASP.Net app. And once created, you need to deploy all needed files (pages, resources, dll's etc). Follow the following article: http://msdn.microsoft.com/en-us/library/ha2y9493.aspx – Jupaol Jun 15 '12 at 00:37
  • I added READ to NTFS (it wasnt checked, so I had a glimmer of hope) but that didnt work either. – Anonymous Jun 15 '12 at 00:39
  • I dont have access to IIS settings..It's a shared environment. I only have "WebsitePanel" – Anonymous Jun 15 '12 at 00:39
  • 403 means you do not have access to the folder, it's a security problem, try enabling Anonymous Authentication in your IIS application – Jupaol Jun 15 '12 at 00:41
  • I checked and it's set to Anonymous Authentication...http://qbressler.com/dash.JPG – Anonymous Jun 15 '12 at 00:43
  • The images you are posting are in the root folder where you want to publish your ASP.Net application?? Because if that's the case there's no problem with the authentication, just try adding a file called default.aspx to the root or just as an expeirment, enable directory browsing (option is in the first screenshot you posted) – Jupaol Jun 15 '12 at 00:50
  • http://qbressler.com/ Now it just displays a blank page :( but atleast there isnt a 403 :) – Anonymous Jun 15 '12 at 00:52
  • no worries you are almost done, you just tested that everything works fine, now just copy all your asp.net MVC files to the root folder and that's it it should work, remember to compile your solution and include the bin folder – Jupaol Jun 15 '12 at 00:54
  • This is going to sound crazy...but I'm not sure what you mean by copy the files? through ftp? Thanks for taking the time. It's much appreciated. – Anonymous Jun 15 '12 at 00:58
  • mm use the same process you did to upload the images and the default.aspx file. The files I am refering to, are the files from your Visual Solution – Jupaol Jun 15 '12 at 01:02
  • http://www.qbressler.com/ftp.jpg I dont get it :( everything is there and it still doesnt work. – Anonymous Jun 15 '12 at 01:06
  • Remove the Defualt.aspx file you just added (that was a test only) – Jupaol Jun 15 '12 at 01:09
  • Also ensure the .Net authorization rules are not blocking your request. See my updated post – Jupaol Jun 15 '12 at 01:11
  • Did you try the .NetAuthorization rules? see the last screenshot in my post – Jupaol Jun 15 '12 at 01:18
  • You could check your web.config file does not contain something like: ` – Jupaol Jun 15 '12 at 01:21
  • none of the options I have on the WebsitePanel resemble those options. – Anonymous Jun 15 '12 at 01:22
  • The way I see it, it can be two root causes, just remember, since you are getting a 403, it's an authorization problem. Now Option 1. You have security in your application and you are denying yourself the access to the application, check the web.config authorization section. Option 2. Since you added a default.aspx file and you got rid of the 403 error, that makes me think the authorization actually works correctly with aspx files the problem could be your provider's configuration. Place a ticket explaining the promblem and inidcate that you have a MVC application – Jupaol Jun 15 '12 at 01:40
  • Thanks. I really appreciate your help. I'm thinking it has something to do on their side as well. I'm going to mark this answer as correct since you really helped me out a lot. – Anonymous Jun 15 '12 at 01:42
4

I had this same issue after publishing an MVC 4 WebSite to a remote server using FTP Publishing. What ended up working for me was after publishing through Visual Studio, log onto IIS on the remote server, locate the published directory -> right click -> Convert to Application.

Not sure if there is a way to specify this in the web.config/properties, if you don't have access to the server?

jack-facts
  • 41
  • 2
3

1- verify that your application is running under .NET 4.0 (you did so)

2- check with the hosting company that it supports the MVC 3 framework on their hosting plan.

3- (works) Bin-Deploy your MVC run-time libraries so you may overcome any requirements on the server.

More bout bin-deploy your ASP.NET MVC can be found here: http://haacked.com/archive/2011/05/25/bin-deploying-asp-net-mvc-3.aspx

4- check that "Network Service" has proper access rights to your folder. it basically should have "Read" permission.

Mohammed Swillam
  • 9,119
  • 4
  • 36
  • 47
2

Don't forget about aspnet_regiis.exe -ir.

sjas
  • 18,644
  • 14
  • 87
  • 92
Cătălin Rădoi
  • 1,804
  • 23
  • 43
  • If you are using Windows Server 2008, this might fix this problem. Likely path to the assembly: C:\Windows\Microsoft.NET\Framework64\v4.0.30319. If you are using Server 2012 you would have to look at server roles instead of this command. – Ralph Feb 06 '17 at 22:08
1
<handlers>
  <add name="rewrite" path="*" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="None" preCondition="classicMode,runtimeVersionv4.0,bitness32" />
</handlers>

Ask your hosting provider to add this handlers into webconfig

0

Try changing the Managed Pipeline Mode of the Application Pool to 'Classic' instead of 'Integrated'. Whilst it may not be the final result that you're after (there can be real advantages in using Integrated mode), at least it will point you in the right direction... if it works.

  • The opposite of this suggestion fixed me. I had to change the ".NET v4.5" application pool to Integrated to fix my published MVC app. – rg89 Jun 04 '20 at 14:02