Setting up MVC with IIS7 and avoiding the 403 14 0 15 Forbidden

Posted: 2011-10-11 in .Net

Problems with 403.14 errors? Can’t install a MVC app on IIS7 here some help ya’s.
Right I’m going to assume you have .NEt 4.0 installed on the server and IIS 7 setup and serving basic pages, basic guide if not  https://support.gearhost.com/KB/a202/how-to-add-a-website-in-iis7-windows-2008.aspx

1. IIS and .Net 4.0. 
Open the IIS manager and click on the server (this will set the setting for all websites)
Scroll in the feature view (bottom icon says feature or content view)
Select “ISAPI and CGI Restrictions”

Now open this setting and make sure the ASP.NET you need has restrictions ALLOW. Otherwise even if the app pool is set to the .Net version you need it wont run. This is a good place to also check .Net installed correctly (misisng if not)

2. MVC requires mapless urls.
For the website that is running MVC,
Select the site
In features select “Handle Mappings”.

Click link “Add Wildcard script map”, found on the right side of the feature view.
For the wildcard add these three settings
*
%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll
MVC

Restart IIS (do the whole thing) and check your web page, stop reading now if it works.

If this works for you (covers 90% of the problems) then it might be a good idea to add the setting directly into the web.config so that you don’t need to do it when you  publish to a different server.

You can do this to each site by adding the required settigns into your web.config, they can be found in the following Microsoft post under option 2

http://support.microsoft.com/kb/2520479/en-us

most of the time you just need


<system.webServer>

<validation validateIntegratedModeConfiguration="false" />
 <modules runAllManagedModulesForAllRequests="true" />
 <add name="ExtensionlessUrl-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG" modules="IsapiModule"
 scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32"
 responseBufferLimit="0" />

 <add name="ExtensionlessUrl-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG" modules="IsapiModule"
 scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64"
 responseBufferLimit="0" />

 <add name="ExtensionlessUrl-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG" type="System.Web.Handlers.TransferRequestHandler"
 preCondition="integratedMode,runtimeVersionv4.0" />

 <add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule"
 resourceType="Either" requireAccess="Read" />

</system.webServer>

3. Add “HTTP Redirect” to IIS
Open “server manager”
click on Web Server IIS
in the main aread scroll until you find “Role Services”
Check for “HTTP Redirection”
Install if not installed (good description by MS if you wonder what this does)

Ok restart the IIS and check your site again

4. Check your web config.

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

99. ASPNET_REGIIS  The last resort.
Before I start this is a bit like throwing away a bike cause the tire is flat. It will reset ALL your webpage defaults

Open command prompt
Go to directory
%windir%\Microsoft.NET\Framework\v4.0.30319
run
aspnet_regiis -i

Then go to
%windir%\Microsoft.NET\Framework64\v4.0.30319
and run
aspnet_regiis -i

if that fails run on both 64 and 32 bit

aspnet_regiis -iru

Both these are complete and utter over kill and if you have any other website on IIS you will now need to recheck all the app pools and settings for each site.

Anyway hope this helped.

Cheers

Choco

Advertisements
Comments
  1. René says:

    Thank you so much! Your steps helped me figure out that the ASP.NET extensions was set to “not allowed”.

  2. Gi says:

    Hello, can this be done via the AppCmd? If so, can u provide the correct syntax! thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s