1

I'm having a hard time configuring my server to host MVC4 application. Here's my situation:

  • I have Windows 2003 server SP2
  • Until now, all my hosted applications are targeted to .NET Framework 3.5, thus using ASP .NET 2. I use single web site to host web application
  • Now, I want to host very first application targeted to ASP .NET 4

What I did is:

  • I've installed .NET Framework 4
  • I've added new new application pool
  • I've added new virtual directory to my web site (the same web site that hosts ASP .NET 2 web apps) and converted it to web application. Next, I've selected ASP .NET version 4 on ASP .NET tab

So, I thought that it would be enough. But when I access my application with root url, the first thing I get is 403. I've checked security options and they seem to be all right. Next, I tried to access one of my controller actions, eg:

http://servername/home/index

and now I get 404 error. Ok, so I've enabled browsing of files and I tried to access web.config, for to check what happens, and I received error:

Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

I've also run regiis command:

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -s W3SVC/2049612577/root/cip-new/

but still in vain. Bottom line, it's something wrong, but I have not idea what is happening.

EDIT 1:

I've made some testing. What I did, is I'd created a basic MVC4 application from Basic template and simply published it to the server. And it worked. However when I published it to the server to the same directory, I got the error:

The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047).]

Andy Davies
  • 1,456
  • 9
  • 13
dragonfly
  • 17,407
  • 30
  • 110
  • 219

1 Answers1

1

2 things I've had to do in the past to get v4 working on IIS6...

  1. Make sure the site using .Net version 4.x runs in it's own app pool, separate to sites using .Net version 2.x

  2. If you are using Razor I've noticed that IIS6 doesn't immediately know what to do. So you need to configure the Application Extensions Mappings. Add an extension mapping for .cshtml or .vbhtml depending on whether using C# or VB. I think that's why you're getting your 404 errors.

application extension mapping

Restart IIS or recycle relevant app pools once above applied if you can to make sure changes are in effect.

Andy Davies
  • 1,456
  • 9
  • 13
  • Well it seems that I have IIS configured properly, as MVC app generated from template works smoothly. However when I deploy application that I was working on, with some third party libs, I get the error: see my edit and this question: http://stackoverflow.com/questions/19976591/the-pre-application-start-initialization-method-run-on-type-webactivator-activat – dragonfly Nov 14 '13 at 11:34
  • Ok you seem like you have an application or dependency issue then. It might be one of your dependencies is not compatible with .net version 4.x. This question might help http://stackoverflow.com/questions/8130109/activationmanager-exception-during-build-process – Andy Davies Nov 14 '13 at 11:38