GoDaddy Tips and Tricks for ASP.NET MVC Web Sites

February 1st, 2011

This miniature troubleshooting guide will help developers who upload ASP.NET MVC web sites to GoDaddy.

When you first start using GoDaddy with WebForms, everything seems simple...you write your site, you upload your changes, attach your connection strings, and immediately test the site. Sometimes things don't go as smooth as you want them to when working with external web hosting companies.

Recently, I've been working on another personal web site and using ASP.NET MVC 2 with Entity Framework 4. Along with finishing up the coding, I've uploaded a "Coming Soon" page to let my users know that I'm almost done with it (and just to get some subscribers signing up).

After going through some trials and tribulations with GoDaddy with ASP.NET MVC, I thought I'd share some of the issues I came across while trying to upload the new web site.

Setting Up Your Account for .NET 4.0

After signing into your account, you want to change your account to use:

After that is set up, you need to head to your "Hosting Dashboard'. Go under Content and click on Add On Languages.

 

Select ASP.NET 4.0 and click Continue.

Your site should now work with ASP.NET 4.0.

This isn't your dad's Classic web site!

Once that is complete, you can move on to changing the type of IIS mode you'll be using with your MVC site. Excuse the pun, but this was a "classic" mistake.

In your "Hosting Dashboard" again, click Content, then IIS Management.

Click on the Advanced button and a panel will slide open revealing either Classic or Integrated. Click Integrated and click OK.

Your ASP.NET MVC 2 application can now be uploaded to GoDaddy using the FTP information they sent you when you set up your hosting account.

You have a Farm and you don't even know it.

GoDaddy works with multiple servers, or clusters of web servers (or web farms). When you are given a hosting account, they provide a space on their server along with other users who own web sites. If you want to pay for a dedicated server when you receive a lot of traffic, go for it.

The reason I mentioned this was because I received an error when I tried to bring up my web site:

"Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster."

Solution: Fix this by creating a MachineKey for your web.config. If you need to create one, one such utility exists here. You want to use the 2.0 version and just copy and paste it right below your opening  <system.web> tag like so:

 <system.web>

	<machinekey ...

Sheesh...Are we done yet?

Almost. One last thing I ran into was using different data types on GoDaddy that I wasn't using in my local schema. Huh?

I received the following error when I tried to view the "Coming Soon" page:

The version of SQL Server in use does not support datatype 'datetime2' or 'date'.

I scoured every piece of code that accessed the schema structure that I transferred over to GoDaddy and I couldn't find any place where I was setting a column to datetime2 or date. Then it hit me...is GoDaddy using the same database as I am?

Personally, I was using 2008 RC2 with the Entity Framework 4 (Model design first). I thought that everything would be compatible when transferring the site over to GoDaddy. Wrong! They are using SQL Server 2005.

To solve this problem, locate the ProviderManifestToken attribute near the top of your edmx file (EF4 files) and change it from 2008 to 2005. Recompile and Deploy.

Conclusion

When I got everything running, I was quite pleased...and not even a call to support. While developers may have an idea of how to fix certain programming issues, it may take them a little longer to figure out web configuration management...especially with a web hosting company.

I hope that these tips and tricks will help someone else out in the long run.

Do you have any GoDaddy tips or tricks? Post them below in the comments.