«

»

Jul
18
2013

How to Deploy your .NET/C# Project on Shared Hosting Environment

Hosting ASP.NET to Shared ServerShared IIS hosting environments are popular and affordable option now days to deploy web projects.

With the modern IDEs like visual studio and advanced host control panels exist today, deploying your ASP.NET projects on shared hosting environments are never been easier. However you will have to be aware of few checkpoints to minimize your debug effort.

If you have the visual studio express 2010 or 2012 you have some handy options to export your .NET solution into independent builds and you can transfer the files to your webserver.

When you test your solution from visual studio it will run from the local cassini IIS server. This does not require any special setup. When you deploy the project to your localhost IIS server, you will be converting your physical directory into application using the option available on IIS manager

Web Control panel equivalent for IIS Convert to Application

However you will not access to IIS manager on a shared hosting environment. So you cannot rely on this option of convert your physical directory into application. Instead you will have to create a virtual directory using your host control panel.

As a first step, you can publish your solution using Web Deploy or File System or FTP options available on visual studio and transfer the files into your webserver.

 

Publish Options From Visual Studio Web Express 2012

Publish Options From Visual Studio Web Express 2012

 

Many host providers offering parallels plesk or cpanel based control panels now a days.

I am showing how to create the virtual directory for your .NET projects on parallels plesk here.

  • Launch your parallels plesk control panel
  • Navigate to Websites & Domains tab
  • Open the group Show Advanced Operations
  • Open the Virtual Directories section

 

Parallels Plesk Virtual Directories Section

Virtual Directories from Parallels Plesk Control Panel

  • Inside Virtual Directories section, at the top you will see the option Create New Virtual Directory

Create Virtual Directory Option from Parallels Plesk Control Panel

 

Note: If you don’t see the option above make sure you are at the root of the domain, I have noticed that this option disappears when you are navigate into sub-directory level.

 

  • With the Create New Virtual Directory option, you can specify all the virtual directory properties such as .NET framework version, physical directory location etc.

.NET/C# Virtual Direcotry Setting on Shared IIS Host Server

 

Once you create the virtual directory you can host your application files in there or you can do the other way – first host the files into a physical directory and create the virtual directory using the steps explained above and specify this physical directory location into the virtual directory properties.

IIS Hosted Environment Physical vs Virtual Directory Configuration

Now your application should launch fine on your shared host environment (make sure you complete the database configuration as well which is not covered here).

 

 

Without creating a virtual directory, your website will not recognize your .NET projects (MVC, Webforms or Websites). They will either throw directory browsing denied error 403.14 – Forbidden

Error 403.14 Forbidden .NET/C# Web Hosting

Or

You will get a runtime error as

An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a “web.config” configuration file located in the root directory of the current web application. This <customErrors> tag should then have its “mode” attribute set to “Off”.

.NET/C# ProjectsRuntime Error

 

Did you find this post useful? Feel free to share your feedback in the comments area.

You can find more interesting posts from us on the??post index??section

If you are interested to be notified for the new posts from us, then you can make use of the subscribe option available on the right side menu.

 

1 comment

  1. aks says:

    Hello, thanks for the insights. i am looking for the detailed guide specifically with Web Deploy Method. Do you know..

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>