简体   繁体   English

如何将asp.net应用程序部署到我的服务器

[英]How to deploy an asp.net application to my server

I have created an ASP.NET web application using visual studio. 我已经使用Visual Studio创建了一个ASP.NET Web应用程序。

Here is the github repository 是github存储库

Currently, a webpage on my website looks like this I only make changes to index.html. 目前,我网站上的网页看起来像这样,我只对index.html进行了更改。

Now that I want to deploy this ASP.NET application on my website, I assumed I would just upload the files to the server, unfortunately, the result does not look like what visual studio displays. 现在,我想在我的网站上部署此ASP.NET应用程序,我假设我只是将文件上传到服务器,但是,不幸的是,结果看起来不像Visual Studio所显示的那样。

Here is what the webpage currently looks like. 是当前网页的外观。

What changes do I need to make to my ASP.NET application so that it will be displayed properly on my website? 我需要对ASP.NET应用程序进行哪些更改,以使其能够正确显示在我的网站上?

Basically before deployment you need to make sure following 基本上,在部署之前,您需要确保以下内容

  1. The server has same or updated version of .Asp.net framework installed, as required by your Asp.net application 服务器已根据您的Asp.net应用程序安装了相同或更新的.Asp.net框架版本。
  2. If there are any database connection strings in web.config files then they must be changed to appropriate live database connections. 如果web.config文件中有任何数据库连接字符串,则必须将它们更改为适当的实时数据库连接。

Then you need to Publish the web application from visual studio. 然后,您需要从Visual Studio发布Web应用程序。 Publishing process will compile your application and will create a full package containing Dll, images, styles and aspx/html files + config files. 发布过程将编译您的应用程序,并将创建一个完整的软件包,其中包含Dll,图像,样式和aspx / html文件+配置文件。

Before publishing starts, visual studio will ask you to create a public profile and there you need to specify Path and Build mode (debug or Release). 在发布开始之前,Visual Studio会要求您创建一个公共配置文件,然后您需要在其中指定路径和构建模式(调试或发布)。 Path can be of your local machine Or directly of live server (I prefre local though) 路径可以是本地计算机的路径,也可以是实时服务器的路径(尽管我优选本地)

Once publish succeeds, you are ready to copy the entire publish folder to live (if your publish path was local). 一旦发布成功,就可以将整个发布文件夹复制到活动目录中(如果发布路径是本地的)。

For more information on deployment read following MSDN reference Deployment process 有关部署的更多信息,请阅读以下MSDN参考部署过程

Which webserver you are using? 您正在使用哪个Web服务器?

The http://devinhaslam.com website is hosted from a apache webserver. http://devinhaslam.com网站由apache网络服务器托管。 If you want run a .net website on a apache you need asp.net core check this https://docs.microsoft.com/en-us/aspnet/core/publishing/apache-proxy 如果要在apache上运行.net网站,则需要asp.net核心,请检查此https://docs.microsoft.com/zh-cn/aspnet/core/publishing/apache-proxy

If you run the website on a IIS, you must only publish the bin folder. 如果您在IIS上运行网站,则必须仅发布bin文件夹。 Check this documentation https://msdn.microsoft.com/en-us/library/dd465337(v=vs.110).aspx 查看此文档https://msdn.microsoft.com/zh-cn/library/dd465337(v=vs.110).aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM