Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best practices for deploying an MVC application on IIS7

I'm not a web admin, and I'm new to IIS. So, I'm looking for advice.

My MVC application (e.g. fooapp) is the default application for my site (e.g. foo.bar). I used IIS Manager to add the site to IIS7. When I import the application, IIS Manager wants to put it in it's own directory (/foo), and tells me I shouldn't put it in the base (site) directory. This means that to get to my default MVC view, I have to enter the URL http://foo.bar/fooapp/. Needless to say, I want to get there via http://foo.bar/

I see 2 possible solutions:

  1. Add a default page to the site directory that redirects to the MVC app.
  2. Ignore the IIS admonition and load the app into the site directory.

My IIS7 knowledge is limited. I have played around with some options (such as HTTP Redirect). Since nothing changed, I obviously don't understand what I'm doing.

Anyway, if there are some considered "best practices" and/or other suggestions, please let me know.

like image 969
gsiler Avatar asked Nov 05 '22 13:11

gsiler


1 Answers

Tbh, I'm not sure why the IIS manager is trying to convince you to add it as a sub app.. Maybe you just didn't do it right >_>

I've got a couple servers running with IIS7/7.5 and they have apps running in the root of the website.. No problem there :)

You might want to create a new website in IIS (right click on websites, choose "Add Web Site"), point the "Physical Path" directly to the folder your website's stored in, and set the Host name to whatever host you use (foo.bar ? :) )

This should work just fine )

In terms of deployment, if you use VS2010 I'd really recomment looking at Web Deploy.. It's a new addon written for IIS7, and allows one-click publish to IIS directly from VS2010. I'm using it on my site and it works flawlessly :)

Check out Scott Hansellman's talk about it, or check it out in the IIS website

like image 168
Artiom Chilaru Avatar answered Nov 11 '22 17:11

Artiom Chilaru