Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install MVC website on IIS7

I use VisualStudio to build a C#-MVC3 Website and it works great.

I need to install the website on a different computer to check it. The computer has IIS7.

I tried to install (my first time... I don't really know IIS), and when I browse the site (localhost/mySite) I can see all the directories (controllers, views...) but I can't see the site itself.

I can see a specific file (like localhost/mySite/Content/img.jpg) but I can't see the site with the controllers (localhost/mySite, or localhost/mySite/Home)

What to to?

like image 744
TamarG Avatar asked Apr 30 '12 09:04

TamarG


2 Answers

First, install ASP MVC, then run one of the following depending on your architecture:

32bit (x86) Windows

%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -ir

64bit (x64) Windows

%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ir

also check this thread for more info: ASP.NET MVC on IIS 7.5

You could also need to recreate your application/site after these steps.

like image 73
mikus Avatar answered Oct 22 '22 07:10

mikus


Extension to @mikus answer (Feb 2017)

I had the exact problem described above with an ASP.NET MVC 4.5 project on my local machine which was showing IIS 403 errors.

The fix which may be of use to others:

1). Follow mikus's answer above (I used the x64 version) in a Command Prompt window. I received a response with an 'unsupported' message, but contained a useful link:

...This option is not supported on this version of the operating system. Administrators should instead install/uninstall ASP.NET 4.5 with IIS8 using the "Turn Windows Features On/Off" dialog, the Server Manager management tool, or the dism.exe command line tool. For more details please see http://go.microsoft.com/fwlink/?LinkID=216771..."

2). Using the step-by-step instructions given in the link to the Microsoft help page: http://go.microsoft.com/fwlink/?LinkID=216771. I only had to do steps 7 and 8, which I have detailed below:

- Open 'Turn Windows features on or off' [Windows key then type 'Turn Windows features on or off' and open]
- Scroll down the list and expand 'Internet Information Services'
- Within that expand 'World Wide Web Services'
- Within that expand 'Application Development Features'
- Make sure 'ASP.NET 4.6' (or 3.5 if you require that) is ticked - mine was not.
- Save and close.

3). Your IIS site should now work as expected - it did for me. Hit the site in the browser again to test.

like image 28
kylebonallo Avatar answered Oct 22 '22 07:10

kylebonallo