Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying an ASP.NET MVC project to server

I'm very new to servers & ASP.NET in general.

I have finished an mvc application using visual studio 2013, tested it locally & it's working fully. I have a .mdf database in my app_data too.

I purchased a domain (asp.net hosting), but now I'm totally stuck and don't know how to do from now on.

My purchased server has a folder named "wwwroot" that I'm supposed to put my files in.

I used filezilla to copy the files manually, yet I get a runtime error when opening my site.

Please, I know that this is basic, but would you give me detailed steps to how to deploy it to my domain ? where to put the files and what's the logic.

Thank you so much.

like image 535
Mohammed Baashar Avatar asked Mar 25 '15 04:03

Mohammed Baashar


1 Answers

You can do it without ftp

Publish Your Application

An ASP.NET MVC application can be published to a remote server by using the Publish commands in WebMatrix ,Visual Web Developer, or Visual Studio.

This function copies all your application files, controllers, models, images, and all the required DLL files for MVC, Web Pages, Razor, Helpers, and SQL Server Compact (if a database is used).

Create the publish profile

  • In Solution Explorer, right-click the ContosoUniversity project (not the ContosoUniversity.DAL project) and select Publish. In the drop-down list, select . (With the latest Visual Studio update installed, there is no drop-down list, and the button to click in order to create a new profile from scratch is Custom.)

In the New Profile dialog box, enter "Test", and then click OK.

  • The wizard automatically advances to the Connection tab.

  • In the Service URL box, enter localhost.

  • In the Site/application box, enter Default Web Site/ContosoUniversity

  • In the Destination URL box, enter http://localhost/ContosoUniversity

  • The Destination URL setting isn't required. When Visual Studio finishes deploying the application, it automatically opens your default browser to this URL. If you don't want the browser to open automatically after deployment, leave this box blank.

  • Click Validate Connection to verify that the settings are correct and you can connect to IIS on the local computer.

  • Click Next to advance to the Settings tab.

  • The Configuration drop-down box specifies the build configuration to deploy. Leave it set to the default value of Release. You won't be deploying Debug builds in this tutorial.

  • Expand File Publish Options, and then select Exclude files from the App_Data folder.

  • In the test environment the application will access the databases that you created in the local SQL Server Express instance, not the .mdf files in the App_Data folder.

  • Leave the Precompile during publishing and Remove additional files at destination check boxes cleared.

  • Finally click the publish button.

More details, you can learn from this visual-studio-web-deployment/deploying-to-iis link

like image 185
Ramesh Rajendran Avatar answered Oct 24 '22 23:10

Ramesh Rajendran