How can I deploy an MVC 4 application to IIS 6? - asp.net-mvc

I'm working on my first MVC application (also my first web project) and want to deploy it to a test server running Windows Server 2003 with IIS 6. It's a simple CRUD app built with VS 2012 using .NET 4, Entity Framework 5. I built the DB first on SQL Server 2005 since my manager wanted to see the DB first. I used the EF Power Tools Beta 4 to reverse-engineer back to Code First. I customized the T4 templates to allow for Data Annotations.
The app works fine using IIS Express on my development PC, but I want to get an initial version out to our test server, which unfortunately, is running IIS 6. Nobody where I work has experience with MVC...just ASP.NET with VB, and I'm having trouble finding good step-by-step instructions on how to deploy it.

first setup extensionless urls based on Phil Haack's blog post: ASP.NET MVC on IIS 6 Walkthrough.
Second Source click here

I found this article to be helpful:
http://www.asp.net/mvc/tutorials/older-versions/deployment/using-asp-net-mvc-with-different-versions-of-iis-cs

Related

When is the mono implementation of mvc 5 expected to come out ?

Currently I am trying to figure out the architecture for a product revamp. The current project is in Asp.Net Webforms 4.0 but I am leaning heavily towards MVC 5 now. Problem is that a few customers (around 10%) do not want to get stuck with Windows Server licensing but our dev team/environment is .Net/Windows based. I was wondering if I could build it in MVC 5 leveraging the latest features like scaffolding, filtering, etc and also be able to port it to Linux based platform through Mono.
Does it sound realistic ?
I wanted to know about the timelines for a stable implementation of MVC 5 in Mono so that I can know whether I can depend on Mono when my team would be working on portability 2-4 months down the line. Otherwise MVC 5 may be a dealbraker for us.
I went through the Mono site and it links to StackOverflow for any questions ... so here I am
MVC 5 will likely never be 100% stable/supported on Mono, as it builds upon System.Web which Microsoft never open-sourced and is difficult to recreate in Mono. edit this may change now that the sources for System.Web have been made open source.
MVC 6 (and all the other stuff from ASP.NET "vNext") is a complete rewrite to get rid of System.Web and will support Mono out of the box, as Microsoft actively tests on it.
See http://www.asp.net/vnext, https://github.com/aspnet/Home and https://github.com/aspnet/Mvc.
My advice would be to keep an eye an ASP.NET "vNext" (it is in development stage right now, but will be the future of ASP.NET for the next decade) if you want to have proper Mono support. You can also start with MVC 5 now, but be aware that there will be breaking changes by the time you upgrade to MVC6.
You could also try Nancyfx, which is a MVC framework that has been built from the start to work with .net and mono.
I currently use it on a project. I develop on windows and .net and then publish(copy files) to Unbuntu and mono. Its very seamless.
Nancy's hosting support is very broad also.
Hosting Nancy with ASP.NET
Hosting Nancy with WCF
Hosting Nancy with Azure
Hosting Nancy with OWIN
Hosting Nancy with Umbraco
Hosting Nancy with Nginx on Ubuntu
Hosting Nancy with FastCgi
Self Hosting Nancy

Odd Things of ASP.NET MVC Deployment on IIS 6

Recently, I am a bit interested in the deployment of ASP.NET MVC application on IIS6 because Phil Haack posted an easier way to deploy ASP.NET MVC application on ASP.NET 4. So I decided to see how different version of ASP.NET MVC works on different version of ASP.NET.
First off, I created an ASP.NET MVC 2 project in Visual Studio 2010 and deploy it to IIS 6 on Windows Server 2003 (only .NET framework 3.5 installed). I set the application to run in ASP.NET 2.0 and no extra stuff. Because I just wanted to see what sort of error would occur. And as expected, some error was reported as following.
Then, I set the Copy Local attribute of System.Web.Mvc assembly to true as following and deploy again.
As a result, the application ran smoothly.
I had read tons of materials talked about the mess of deploying MVC application on IIS 6. And I did fight to tackle the deploying issues in my previous project. At least, if had used Extensionless Url in your application, you should have configured wildcard mapping in IIS. But in this case, I even didn’t have chance to do so.
What the heck was going on exactly? Did I discover a new continent?
Perhaps your IIS is configured with a wildcard module mapping. With other words, the request path ".*" is being send to the asp.net ISAPI module.

Is there a certain IIS configuration required to allow a functioning .Net 4.0 ASP.Net MVC 2 Azure application?

I just installed the Azure 1.2 tools update and would like to get to work on an Azure project running locally using ASP.Net MVC and .Net 4, but I cannot get MVC pages to load.
If I just create a new Azure project in VS 2010, add a ASP.Net MVC web role, and run the application, pages never load. It appears that routing is somehow at fault as controller actions never get called, but if I add other pages to the project (like .htm or .aspx) they will load in the browser.
It all works fine with a new project using .Net 3.5, MVC 2 project in the Azure development environment; it all works fine with .Net 4.0 MVC 2 project that is not running in Azure; only the combination does not work.
Environment is Win 7 x64 (IIS 7.5), VS 2010, Azure tools 1.2
Is there some magic IIS setting I need to change or something? Any ideas?
Check if you have "HTTP Redirection" feature enabled.
See here

I want to use ASP.Net MVC. My server is Win 2003 and it uses IIS 6, will all this work together?

ASP.Net MVC is finally available as version 1. I have been waiting for an official release before I try to start using it. At the moment I have a dedicated web server which I have complete access to via remote desktop. It is running Win 2003 Server with IIS6 (I think it is IIS6, they don't print the version in the Help -> About but a bit of research says that IIS6 is the standard on Win 2003 Server) and .Net 2.0.
Obviously I will need to upgrade the framework to .Net 3.0. But after that, should everything else work? I thought I saw somewhere that .Net 3.0 insists on IIS7. If that is true is IIS7 compatible with Windows 2003 Server?
Also any literature you can point me to or any tips on making the upgrade/transition?
EDIT:
Sorry too excited guys. Yes I meant .Net 3.5. :D
EDIT: LAST QUESTION:
Someone mentioned a routing problem. I remember reading that somewhere but can't quite remember. My project relies heavily on a good Google Ranking and I don't want to sacrifice page rank because of a routing problem. Will I still be able to get around it with IIS6? Thanks again. :D
You'll need .NET Framework 3.5, not 3.0. Better be SP1. There'll be no problems with that setup. Make sure your read http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx
By the way, IIS7 cannot be installed on Windows Server 2003. ASP.NET MVC and .NET Framework 3.5 SP1 do not rely on any IIS7 specific features.
As per the link mentioned by Andrew (above), you have two choices with IIS6:
Add the mvc prefix to the routes (eg. {controller}.mvc/{action}/{id} )
Use the wildcard mapping (only IIS6/Win2k3 and not win XP/iis 5.1)
The drawback of number 2 is that it can cause performance problems if you have a lot of traffic. However, there is workaround to this that involves creating a separate subdirectory for static files like gifs/jpegs/scripts etc. See Steve Sanderson’s blog post for details
Yes, it's possible to run an ASP.Net MVC site on Windows 2003 server running IIS 6.0, though there's a little more configuration to do in IIS 6.0 because of the routing. Oh, and you'll need .Net Framework 3.5 SP1.
The documentation and steps you'll need to take are on the ASP.Net MVC deployment page :o)
On Windows 2003/XP, we use IIS7 Express to host our ASP.NET 4 MVC 3 web applications.

ASP.NET MVC and .NET 3.5 SP1 on Windows Server 2003 and IIS

I am writing a website for a client who says their servers run the following: "Windows 2003 with the latest IIS". What do I need to do to get them ready for hosting my ASP.NET MVC website built with .NET 3.5SP1?
You'll probably also run into an issue with IIS6 on Win2k3. Phil Haack posts an excellent walkthrough on his blog Asp.Net MVC on IIS 6 Walkthrough.
You'll also need the following prereqs:
.Net 3.5 SP1
Asp.Net MVC Beta
Just have them install .Net 3.5 SP1 redist.
EDIT They will of coarse have to create the virtual directory for your web app, create an application on that directory, give proper permissions, and possibly manually set the ASP.Net to the v2.0.
Windows 2003 with the latest IIS? Well,this isn't really possible since you can't run IIS7 on Windows Server 2003. You'll need to upgrade to Windows Server 2008 in order to run the latest IIS.
That said, if you are running IIS6, you have to jump through some hoops. There are a couple of best practices (Url file extensions or wild card application maps) which Phil Haack has well documented which will help to get your application running correctly.
If you want to bin-deploy MVC, just install .NET 3.5 SP1. If you want to get MVC installed in the GAC, they should install the MVC beta as well.
Create a Web Setup project and add .net 3.5 as a prerequisite. The installer asks what virtual directory to install to.

Resources