Home > Backend Development > C#.Net Tutorial > Detailed explanation of the process of publishing ASP.NET website

Detailed explanation of the process of publishing ASP.NET website

Y2J
Release: 2017-05-06 11:52:59
Original
4724 people have browsed it

This article mainly introduces the detailed process of releasing ASP.NET programs, which has certain reference value. Interested friends can refer to it

Preface

When publishing an ASP.NET website, whether you are a beginner or an expert, there will be more or less problems during the program publishing process, such as VS failure to publish the ASP.NET program, IIS installation failure, IIS publishing failure, LAN failure, etc. A series of problems such as inaccessibility,

config file errors, insufficient permissions, etc., combined with the various problems reported by the technical team of more than 500 people led by me, I will take a moment to summarize today. , it is convenient for everyone to learn together and make progress together.

For the in-depth and detailed analysis later, I wrote a small Demo and the code is attached. This tutorial is based on VS2013 and the OS is WIN10, IIS7 and other environments. (The principles of other operating systems such as WIN7 are similar, but there are subtle differences)

1. Overall solutionOverview

2. Front-end

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="sessionDemo.aspx.cs" Inherits="Test.sessionDemo" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 <title></title>
</head>
<body>
 <form id="form1" runat="server">
 <p>
  <p><asp:Button ID="btnSesison" runat="server" Text="Session" OnClick="btnSesison_Click" /></p>
   
 </p>
 </form>
</body>
</html>
Copy after login

3. Back-end

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Collections;
namespace Test
{
 public partial class sessionDemo : System.Web.UI.Page
 {
  protected void Page_Load(object sender, EventArgs e)
  {
    
  }

  protected void btnSesison_Click(object sender, EventArgs e)
  {
   //Session["a"] = "a";
   //Session["b"] = "b";
   //Response.Write(Session["a"].ToString());
   //Response.Write(Session["b"].ToString());
   string[] strSession = { "王文佳", "赵武", "杨雄", "熊熊" };
   createSession(strSession);
   getSession();
  }

  #region 自定义方法
  //创建Session
  public void createSession(string[] arrStr)
  {
   //创建数组
   string[] str=new string[arrStr.Length];
   for (int i = 0; i < arrStr.Length; i++)
   {
    str[i] = i.ToString();
    Session[str[i]] = arrStr[i];
   }
  }

  //遍历Session
  public void getSession()
  {
   IEnumerator sessionEnum = Session.Keys.GetEnumerator();
   while (sessionEnum.MoveNext())
   {
    Response.Write(Session[sessionEnum.Current.ToString()].ToString()+";");
   }
  }

  //清空Session,但不结束会话
  public void clearSession()
  {
   Session.Clear();
  }
  //结束Session会话
  public void abandonSession()
  {
   Session.Abandon();
  }
  #endregion
 }
}
Copy after login

4.Test results

1. ASP.NET program release

1. Open the solution with VS2013.

2. Select the solution, click the "right button" of the mouse -> From the pop-up dialog box, select "Clean Solution".

3. After step 2 "Clean Solution" is completed, select "Solution" -> click the "right button" of the mouse -> in the pop-up dialog box , select Rebuild Solution.

4. After step 3 of "Regenerate Solution" is completed, select the web application, such as "testDemo" in the picture below—> click the "right button" of the mouse— >In the pop-up dialog box, select "Publish".

5. Set the "Configuration File" node and click "Next".

6. Set the "Connection" node and click "Next".

#7. Set the "Settings" node and click "Next".

8. Set the "Preview" node and click "Publish".

9. The published file is as shown below. At this time, the file is published successfully. After the publication is successful, click on the folder and the .cs files of all pages are put into the bin. .

2. IIS installation

1. Open the "Control Panel" ->Select "Programs".

#2. Select "Turn Windows features on or off" in the pop-up dialog box.

3. In the pop-up dialog box, select "Internet Information Services" (if you are a beginner, it is recommended to select all, for veterans, select as needed), click "OK" .

#4. After clicking OK, the system is applying the changes.

#5. After the application change is completed, select "Restart now". After the system restarts, the IIS configuration is completed.

6. After restarting the computer, test whether the IIS configuration is successful. In the browser bar, enter "http://localhost". If the following interface appears, it means that IIS is installed successfully.

3. IIS publishing website

#1. Enter "I am Cortana, Cortana, if you have any questions, please ask me" Enter "Internet Information Services" in the box.

2. Open the IIS main interface.

3. Select "Website" -> Click the "right button" of the mouse, and in the pop-up dialog box, select "Add Website".

#4. In the pop-up dialog box, set the relevant parameters.

#5. At this time, in the IIS main interface, "Website" has an additional site "www.testWebSite", which is the name given to the site just now.

6. Configure application pool

7. Configure default document

#8. After the default document is added successfully, it will be as shown in the figure below:

9. In order to prevent insufficient permissions, Add the member "everyone" to the file just published and grant permissions. Right click—>Properties—>Security—>Edit—>Add

—>Enter “everyone”—> Grant permissions to user everyone —>OK.

10. Register for IIS. Find the capital V in the program you are using, select "Visual Studio 2013" ->Select "Visual Studio Tools" ->Select "VS2013 Developer Command Prompt" as an administrator, and enter CMD. Enter "aspnet_regiis -i".

11. At this point, the entire release is over.

12. Test. Enter: "localhost:8090/sessionDemo.aspx" in the browser address bar to visit.

13. At this point, the IIS website publishing process is over.

4. Things to note when configuring IIS##1. Registration issues with IIS

Find the capital V in the program you are using. Select "Visual Studio 2013" ->Select "Visual Studio Tools" ->Select "VS2013 Developer Command Prompt" as an administrator and enter CMD. Enter "aspnet_regiis -i".

##2. Insufficient permissions problem

Click on the VS published file, right-click->Properties->Security->Edit->Add —>Enter “everyone”—>Give permissions to user everyone—>OK.

3. Firewall problem

The LAN cannot be accessed, mostly due to firewall problems. If you turn off the firewall directly, it will not be safe. The following solutions are recommended.

The HTTP service uses port 80 by default. You only need to enable the HTTP service (port 80) in the firewall (pay special attention to the firewall that comes with the system); if you use

other

firewalls, you can also A similar operation is required.

a. Start->All Programs->Administrative Tools->Windows Firewall with Advanced Security->In the left column of Windows Firewall with Advanced Security; select "Inbound Rules"->Select "New" in the right column Rule "—> In the pop-up

window, select: Select port—> Next step—> Select TCP and specific local port and fill in the port number to be opened (fill in 80 here; if so You can choose to open all ports
Next step->Select Allow connection->Next step->Select all options->Next step->Fill in the name (fill in IIS here).

#4. Check whether IIS is installed successfully.

Enter http://localhost in the browser URL. If the following interface appears, it means the installation is successful.

5. Port problem

The default http port is: 80. When publishing IIS, select another port.

# #6. The application pool should have the same name as the website, select the integration method (if the release fails, you can switch back and forth between classic and inheritance

), and select version V4.

7. When publishing VS, select the Release version instead of the Debug version, and select any CPU when switching the CPU.

##8. Eliminate the above problems. In addition, there are other questions, I will

update

gradually.

Thank you for reading. If there are any shortcomings, please give us your advice and let us learn and make progress together. [Related recommendations]

1. ASP free video tutorial

2.

ASP tutorial

3. Li Yanhui ASP basic video tutorial

The above is the detailed content of Detailed explanation of the process of publishing ASP.NET website. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template