23

I want to know about a thing that IS ASP.NET MVC 4 application can be run on .NET 4 server.

I am trying to deploy my MVC4 application and I am got the error that.

500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.

I target the .net 4 framework but I am still having this error. I am not sure what happen to server. I am trying to look on other post but I did not find any post who can clearify that MVC 4 can run on .net server.

IAbstract
  • 19,551
  • 15
  • 98
  • 146
user1240424
  • 259
  • 1
  • 2
  • 5
  • 1
    What do you mean by ".NET 4 server"? Are you trying to run this in a homemade server app, instead of doing the normal thing and running it in IIS? – Joe White Mar 03 '12 at 17:57
  • @JoeWhite Means Window based server who have .net 4 application can work also able to run MVC 4. Please edit my question if It's make a confusion. – user1240424 Mar 03 '12 at 18:02
  • The 500 error could mean just about any error... Can you look in the eventlog of the server? – H H Mar 03 '12 at 18:16
  • @HenkHolterman Actually I got a server from someone help to test my own scripts. I have installed in subdomain / dierectory. – user1240424 Mar 03 '12 at 18:20
  • 3
    Is MVC4 installed on the server? If not you will need to bin deploy by following the instructions here http://haacked.com/archive/2011/05/25/bin-deploying-asp-net-mvc-3.aspx. This is for MVC3 but I think it should be the same for 4. Also, would be helpful if you posted the stack trace. – James Hull Mar 03 '12 at 18:21
  • No it's not. I am trying to get deployed directly by copy the source on server. – user1240424 Mar 03 '12 at 18:22
  • Would you please advise the full error message that you get from the server? 500 internal server error means a lot. Do you host by your own server or with hosting provider? Could you please kindly check that ASP.NET MVC 3 has been configured correctly? –  Mar 05 '12 at 01:32
  • I ran into the same issue-- there is nothing in the event log nor is there a stack trace. This only impacts the ApiController – Elan Hasson Mar 09 '12 at 06:33

3 Answers3

32

Yes. ASP.Net MVC 4 will run on ASP.Net 4 and ASP.Net 4.5. I am running a site on ASP.Net 4, and it is also confirmed in this blog post by Scott Gu. This assumes that you are not targeting any new 4.5 features in your application.

Be sure that you are copying the required MVC 4 .dll files in your bin folder if the server does not already have them installed. This post by Phil Haack explains how to bin deploy version 3. Hanselman has a similar article. You will need to check the version 4 release notes for the current .dlls required.

We may be able to provide a more specific answer if you can provide some additional details, and let us know what version of IIS and Visual Studio you are running.

Dan Sorensen
  • 11,403
  • 19
  • 67
  • 100
5
  1. Right click your mvc4/webapi project ,choose the "Add Library Package Reference..." item, checked the "ASP.NET MVC" checkbox .
  2. Install DotNet Framework 4 Client Profile on your server.Because of the reference item "System.Net.Http" target framework is .net4 client profile.
  3. Publish your mvc4 project to your server
  4. enjoy......:)_
azraelrabbit
  • 96
  • 1
  • 5
2

Razor 2 is part of the next wave of the WebPages/MVC framework so it will require MVC4. There's nothing stopping you from using our Open-Source code to wedge Razor 2 in to MVC3, but it isn't a supported scenario.

Remember that MVC 4 works on .NET 4.0 and does NOT require .NET 4.5!

ASP.net mvc programmer blog

gdoron
  • 147,333
  • 58
  • 291
  • 367
  • no it doesn't require 4.5, until you use 4.5 features like bundling/async/await, then you bomb out : ) – Adam Tuliper Dec 10 '12 at 09:02
  • @AdamTuliper, o.k. but it's not just mvc4... you can't use async without 4.5, it has nothing to do with asp.net or asp.net-mvc-4 – gdoron Dec 10 '12 at 19:10
  • Sure it does - async is used in mvc4 source so it has to do both with mvc4 and .net 4.5, but we both know the end result though- if you want that, you clearly need 4.5, if not you are good to go. . – Adam Tuliper Dec 12 '12 at 08:19
  • 1
    FYI, async is still available in MVC4+.NET4.0 if you reference the [`Microsoft.Bcl.Async`](http://nuget.org/packages/Microsoft.Bcl.Async/) NuGet package. (VS2012 is required, though) – Richard Szalay May 06 '13 at 06:13