Publish Razor to GoDaddy via Visual Studio

It’s not difficult to find a few discussion forums on How to Publish Razor to GoDaddy via Visual Studio 2013 on Google. In this post, I will attempt to write down my own experiences and summarise some issues that I’ve encountered:

Tools to use:

  1. GoDaddy Windows (Plesk) shared hosting account that supports .Net 4.0
  2. Microsoft Visual Studio 2013 Enterprise

Publish an Razor Website:

If all goes well, its really straight forward:

  1. Login GoDaddy gateway godaddy-login
  2. Click on the “manage” button on the site you want to work ongodaddymanage1
  3. On the dashboard (if you do not see any items on the dashboard, click on a small button in the middle that says “show more”), then click on the link Web Deploy Publishing Settingswebdeploypublsihprofile
  4. It should prompt you to download a file. Save the file to local drive where your Visual Studio lives.
  5. Right click on your website project name in Visual Studio and click on “publish website”
  6. Chose to deploy it to website
  7. Browse to the file that was downloaded in step 4. This should automatically pre-fill all the information you need to publish the website.
  8. Click next then next again or just click on “publish”.

Error #1: Security Exception

After publishing the website, you get the ‘/’ error. You then turning off the remote error, to see more details of the error. If you see the following:

secError-1024x508

Error description:

Security Exception
Description: The application attempted to perform an operation not allowed by the
security policy. To grant this application the required permission please contact your
system administrator or change the application’s trust level in the configuration file.

Exception Details: System.Security.SecurityException:

Request for the permission of type ‘System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxx’ failed.

Source Error: …

Solution:

If you want to read up on Security Exceptions, here is the MSDN link.

What you need to do is to change your site’s trust level if its not already set to FULL:

  1. Follow steps 1 & 2 from the publish website section above
  2. On the dashboard (if you do not see any items on the dashboard, click on a small button in the middle that says “show more”), then click on the link ASP.NET Settings GoDaddy .Net Setting
  3. From the CAS trust level menu, select the settings to FULL, and then click OKcasSetting

I noticed that sometimes, you need to repeat the above steps when you re-deploy the same website again from Visual Studio.

Error #2: Time out

errIf you get the above error in Visual Studio, just try to publish the website again. It’s basically telling you that the connection between the Visual Studio and your GoDaddy host had dropped out.

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: