Hosting Error :500 – internal server error

Many of our clients ask us how to deploy their ASP.NET MVC 3 to a web hosting service. So, I decide to make this tutorial. They asked because when they attempted to upload their app’s files, they saw this:

Problem

When you install MVC 3 on your local machine, a number of assemblies are registered in the GAC. MVC 3 needs these assemblies. Unless your web hosting service has installed MVC 3 on their servers (and many haven’t, yet), those assemblies won’t be there, and you’ll see an error similar to the one above.

Solution

As with previous versions of MVC, we suggest you solve this with what we call “\bin deployment.” Bin Deployment is just a fancy term that means “include the MVC assembly (and its dependencies) in your web application’s /bin folder.” It’s not hard to prepare your project for Bin Deployment, but there are a few more assemblies involved compared to MVC 2. I’ll show you what you need to do, step by step.

1. Add Explicit References for MVC and Its Dependencies

Your MVC app’s project probably won’t have references to all of the assemblies it needs, because they’re in the GAC. So you need to add them. Here is the list (they’ll all be available in the .NET tab of the Add Reference dialog):

– Microsoft.Web.Infrastructure
– System.Web.Helpers
– System.Web.Mvc
– System.Web.Razor
– System.Web.WebPages
– System.Web.WebPages.Deployment
– System.Web.WebPages.Razor

2. Change Each Reference’s Copy Local Property to True

After adding the references, you need to set the Copy Local property for each of the references you just added to True, as pictured below


3. Re-Build and Deploy as You Normally Would

Now, when you build your app, the MVC assembly and its dependencies will be copied to the /bin directory, allowing you to deploy as you normally would.

main thread : http://asphostportal.com/Cheap-ASPNET-MVC-3-Hosting.aspx

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s