fbpx
After spending hours and pulling my hair out over the deployment error , i finally found a solution, but before i talk about the actual solution, i will provide some context to the underlying problem. I have recently developed an ASP.NET application using the MVC2 framework and when i tried to deploy the application on IIS i encountered a deployment error.

The link between .NET framework (any version) and IIS

This is the least visible problem of them all, because you are most likely to assume that this has already been taken care of. This is not an issue if IIS is installed before the .NET framework, however  if IIS is uninstalled or installed after the .NET framework has been installed than it does not automatically establish the link between the two . In case of the latter the issue can be resolved by manually establishing the link between IIS by the following steps
start the command prompt and navigate to the directory where you have installed the ASP.NET framework
e.g. cd  C:WindowsMicrosoft.NetFramework (the full name of the folder will determine the version number)
and run the following command aspnet_regiis –i
This should install the .NET framework and establish the link between IIS as well as .NET framework 4.0.

Application pool pointing to the wrong framework

When you create a new website IIS 7.5 creates an application pool with the same name as the website, by default IIS 7.5 assigns 2.0 as the target .NET framework. In order for an MVC application to work, it must point to .NET framework 2.0.
In order to change the target framework
  1. Right-click the application pool
  2. select advanced settings
  3. In the general tab and change the .NET framework version to 4.0

Web application unable to access the database error

This error stems from the fact that Identity is set to the default ApplicationPoolIdentity, in order to resolve this issue change the Identity to Local System or a custom account which has the permission to access the database.

Leave a Reply

Your email address will not be published. Required fields are marked *