5

I've just installed .NET 4 on Windows SErver 2008 R2 x64 and I am getting 500 Internal Server Error with an ASP.NET MVC application which was previously running fine on 3.5. The application was upgraded from targeting 3.5 to target 4 and I personally built it today on my development machine (changed in VS - Properties to .NET Framework 4).

On the server I installed .NET Framework 4 Client profile and Full both automatically through the Web Platform Installer. ASP.NET MVC 2 was also installed through Platform Installer. I created a new .NET 4 application pool in IIS and placed the web app in it.

Also I have custom errors turned Off in web.config but even so no detailed error is displayed - just the plain IIS 7.5 500 Internal Server Error.

Any suggestions?

mare
  • 13,033
  • 24
  • 102
  • 191
  • did you only install client profile on the server or the full framework? – Mauricio Scheffer Mar 16 '10 at 13:10
  • I'd start by suggesting turning errors on, to find out a little more, for a start... – Rowland Shaw Mar 16 '10 at 13:10
  • @Mauricio: As it says in the question, I installed Client Profile. @Rowlad: You mean On or Off? Currently CUSTOM errors are OFF, so it should display detailed exceptions. – mare Mar 16 '10 at 13:27
  • does MVC even run with client profile? did you try installing the full framework? – Mauricio Scheffer Mar 16 '10 at 15:35
  • I left this question off for until .NET 4 RTM and now that we have it, I removed RC and installed 4 RTM through Web Platform Installer. The same error still exists, no events in application or system log, nothing. – mare Apr 21 '10 at 09:31
  • Is the app running on your machine if you run it up through visual studio in debug mode? By default visual studio uses it's own web server that isn't IIS the info could be helpful. – PeteT Apr 26 '10 at 13:56
  • The application is running within VS webserver and within IIS if it is at the root level of the website - so if it is not inside a subdirectory, which has been converted to an application. – mare Apr 26 '10 at 17:48

4 Answers4

6

Well, that's a very strange and interesting issue.. But I'm eager to help as much as I can. I've currently got a VPS with Server 2008 R2, and I've installed .NET 4 RTM, and MVC 2 on it. Don't think I've run into configuration issues, but I have had to help set up some other people with it..

Initially, could you check.. in your IIS manager, Isapi and Cgi restrictions, do you have .NET 4 in there? Which versions? are they enabled?

If you go to your app pools in IIS, are your app pools ser to .NET 4, the NEW version? Double check this, your app pools might be set to a different build of the .NET 4 framework, that has since been removed / disabled. You can try create a NEW website with a new clean app pool just to test if it works.

If nothing works yet, you can try to re-register .NET in IIS with aspnet_regiis -i

If none of these work, I'll try to come back with some more options/ideas

Artiom Chilaru
  • 11,811
  • 4
  • 41
  • 52
4

I usually solve that kind of problem by reinstalling the ASP.NET support files on the IIS.

  1. Open a command prompt with admin privileges (Command Prompt, right-click, Run as Administrator)
  2. Type in:

    cd %WINDIR%\Microsoft.NET\Framework64\v4.0.XX.XX

    aspnet_regiis -i

Done. You might need to open IIS and reassign your application pools to the newly created "ASP.NET 4.0 Integrated" (or Classic).

Fábio Batista
  • 25,002
  • 3
  • 56
  • 68
  • My configuration is fine and I have the new ASP.NET 4 app pools. The problem is that I'm running my app in virtual directory and there seems to be something wrong with Web.Config inheritance. I just tested creating a new root website in IIS and putting it into .NET 4 Integrated app pool and it works fine. – mare Apr 24 '10 at 19:28
0

I have also small compatibility problems with my ASP.NET MVC application. It can be you have the same problem.

I used NoSessionControllerFactory to disable SessionState based of How can I disable session state in ASP.NET MVC? and http://billrob.com/archive/2009/07/15/asp-net-mvc-without-sessionstate.aspx. After updating to .NET 4.0 my application didn't work. I received also 500 Internal Server Error. After small modification of NoSessionControllerFactory from Global.asax.cs the world was OK. The fixed code looks like following:

public class NoSessionControllerFactory: DefaultControllerFactory {
    protected override IController GetControllerInstance (RequestContext requestContext, Type controllerType) {
        if (controllerType != null) {
            var controller = base.GetControllerInstance (requestContext, controllerType);
            ((Controller)controller).TempDataProvider =
                new DummyTempDataProvider ();
            return controller;
        }
        else
            return null;
    }
}
public class DummyTempDataProvider: ITempDataProvider {
    public IDictionary<string, object> LoadTempData (ControllerContext controllerContext) {
        return new Dictionary<string, object> ();
    }
    public void SaveTempData (ControllerContext controllerContext,
        IDictionary<string, object> values) {
    }
}

The class will be used inside of Global.asax.cs like:

protected void Application_Start () {
    RegisterRoutes (RouteTable.Routes);

    // see https://stackoverflow.com/questions/884852/how-can-i-disable-session-state-in-asp-net-mvc
    ControllerBuilder.Current.SetControllerFactory (new NoSessionControllerFactory ());
}
Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
0

I bet that it is a configuration issue with the application in question. ASP.NET 4's configuration differs from 3.5's.

And also, make sure that your web application references the DLL's from .NET 4, and not .NET 3.5.

Venemo
  • 18,515
  • 13
  • 84
  • 125