.NET Framework 4 RTM on Windows server 2008 R2
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 create开发者_如何学Pythond 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?
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
I usually solve that kind of problem by reinstalling the ASP.NET support files on the IIS.
- Open a command prompt with admin privileges (Command Prompt, right-click, Run as Administrator)
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).
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 ());
}
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.
精彩评论