Skip to main content

ASP.NET MVC2 and IIS 7.5 deployment issue

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:\Windows\Microsoft.Net\Framework (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.

Comments

Popular posts from this blog

Upload to AWS S3 from Java API

In this post, you will see code samples for how to upload a file to AWS S3 bucket from a Java Spring Boot app. The code you will see here is from one of my open-source repositories on Github, called document-sharing. Problem Let’s say you are building a document sharing app where you allow your users to upload the file to a public cloud solution. Now, let’s say you are building the API for your app with Spring Boot and you are using AWS S3 as your public cloud solution. How would you do that? This blog post contains the code that can help you achieve that. Read more below,  Upload to AWS S3 bucket from Java Spring Boot app - My Day To-Do (mydaytodo.com)

Addressing app review rejections for auto-renewing subscription in-app purchase (iOS)

The ability to know what the weather is like while planning your day is a feature of  My Day To-Do  Pro and as of the last update it’s also a part of the  Lite version . Unlike the Pro version it’s an auto-renewing subscription based  in-app purchase (IAP)  in the Lite version. What means is that when a user purchases it, the user only pays for the subscription duration after which the user will be automatically charged for the next period. Adding an  auto-renewing  subscription based IAP proved to be somewhat challenging in terms of the app store review i.e. the app update was rejected by the App Review team thrice because of missing information about the IAP. Therefore in this post I will share my experiences and knowledge of adding auto-renewing IAP in hopes to save someone else the time that I had to spend on this problem. In-App purchase This year I started adding IAPs to My Day To-Do Lite which lead to learning about different types of IAP...

Serving HTML content in an iOS app that works in iOS 7 and later (using Swift)

As I have mentioned in an earlier post , I really enjoying coding in Swift. Now what am I doing with it? Well I am trying to build an HTML5 app that must work on devices with iOS 7. So in iOS8 apple has introduced a whole bunch of features that facilitate easy communication between web content and lets just call it back-end Swift code, but those features are not in iOS 7. So why do I want to build something that would work in an older OS? well I do not expect existing iOS users to upgrade to iOS 8 straight away and i also know a couple of people who would be very reluctant to upgrade their iPhones to iOS 8. Now in case you do not, you can have a read of the "Working with WebViews" section of this post , to know how to serve HTML content with WebViews. So when I started building my app, I wanted to know: How do I invoke some Swift code from my HTML content? Well the solution to this may feel a little bit "hacky" but it is a solution to achieve this.  The followi...