Deploy an ASP.NET MVC project to a server

I am very new to servers and ASP.NET in general.

I finished the mvc application with visual studio 2013, tested it locally and worked completely. I also have a .mdf database in my app_data.

I bought a domain (asp.net hosting), but now I am completely stuck and do not know how to do it from now on.

My purchased server has a folder called "wwwroot" in which I have to put the files.

I used filezilla to copy files manually, but when I open my site I get an error at runtime.

Please, I know that this is basic, but could you give me detailed instructions for deploying it to my domain? where to put the files and what is the logic.

Thank you very much.

+7
c # asp.net-mvc
source share
1 answer

You can do it without ftp

Publish your application

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

This function copies all your application files, controllers, models, images, and all the necessary DLL files for MVC, web pages, Razor, Helpers, and SQL Server Compact (if using a database).

Create Publication Profile

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

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

  • The wizard automatically switches to the Connection tab.

  • In the Service URL field, enter localhost.

  • In the "Site / Application" field, enter "Default Website / ContosoUniversity"

  • In the Destination URLs field, type http: // localhost / ContosoUniversity

  • No destination URL required. When Visual Studio completes the deployment of the application, it automatically opens the default browser for this URL. If you do not want the browser to automatically open after deployment, leave this field blank.

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

  • Click “Next” to go to the “Settings” tab.

  • The Configuration drop-down list configures the assembly for deployment. Leave it at the default value of Release. You will not deploy Debug assemblies in this tutorial.

  • Expand file publishing options, and then select Exclude files from the App_Data folder.

  • In a test environment, the application will access databases created on the local instance of SQL Server Express, and not in the .mdf files in the App_Data folder.

  • Leave the Precompile check box at the time of publication and delete additional files in the destination folder.

  • Finally click the publish button.

You can learn more about this from visual-studio-web-deployment / deploying-to-iis

+6
source share

All Articles