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

May 06, 2017 am 11:52 AM

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!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1657
14
PHP Tutorial
1257
29
C# Tutorial
1230
24
C# .NET Interview Questions & Answers: Level Up Your Expertise C# .NET Interview Questions & Answers: Level Up Your Expertise Apr 07, 2025 am 12:01 AM

C#.NET interview questions and answers include basic knowledge, core concepts, and advanced usage. 1) Basic knowledge: C# is an object-oriented language developed by Microsoft and is mainly used in the .NET framework. 2) Core concepts: Delegation and events allow dynamic binding methods, and LINQ provides powerful query functions. 3) Advanced usage: Asynchronous programming improves responsiveness, and expression trees are used for dynamic code construction.

Testing C# .NET Applications: Unit, Integration, and End-to-End Testing Testing C# .NET Applications: Unit, Integration, and End-to-End Testing Apr 09, 2025 am 12:04 AM

Testing strategies for C#.NET applications include unit testing, integration testing, and end-to-end testing. 1. Unit testing ensures that the minimum unit of the code works independently, using the MSTest, NUnit or xUnit framework. 2. Integrated tests verify the functions of multiple units combined, commonly used simulated data and external services. 3. End-to-end testing simulates the user's complete operation process, and Selenium is usually used for automated testing.

C# .NET: Exploring Core Concepts and Programming Fundamentals C# .NET: Exploring Core Concepts and Programming Fundamentals Apr 10, 2025 am 09:32 AM

C# is a modern, object-oriented programming language developed by Microsoft and as part of the .NET framework. 1.C# supports object-oriented programming (OOP), including encapsulation, inheritance and polymorphism. 2. Asynchronous programming in C# is implemented through async and await keywords to improve application responsiveness. 3. Use LINQ to process data collections concisely. 4. Common errors include null reference exceptions and index out-of-range exceptions. Debugging skills include using a debugger and exception handling. 5. Performance optimization includes using StringBuilder and avoiding unnecessary packing and unboxing.

From Web to Desktop: The Versatility of C# .NET From Web to Desktop: The Versatility of C# .NET Apr 15, 2025 am 12:07 AM

C#.NETisversatileforbothwebanddesktopdevelopment.1)Forweb,useASP.NETfordynamicapplications.2)Fordesktop,employWindowsFormsorWPFforrichinterfaces.3)UseXamarinforcross-platformdevelopment,enablingcodesharingacrossWindows,macOS,Linux,andmobiledevices.

The Continued Relevance of C# .NET: A Look at Current Usage The Continued Relevance of C# .NET: A Look at Current Usage Apr 16, 2025 am 12:07 AM

C#.NET is still important because it provides powerful tools and libraries that support multiple application development. 1) C# combines .NET framework to make development efficient and convenient. 2) C#'s type safety and garbage collection mechanism enhance its advantages. 3) .NET provides a cross-platform running environment and rich APIs, improving development flexibility.

Advanced C# .NET Tutorial: Ace Your Next Senior Developer Interview Advanced C# .NET Tutorial: Ace Your Next Senior Developer Interview Apr 08, 2025 am 12:06 AM

Interview with C# senior developer requires mastering core knowledge such as asynchronous programming, LINQ, and internal working principles of .NET frameworks. 1. Asynchronous programming simplifies operations through async and await to improve application responsiveness. 2.LINQ operates data in SQL style and pay attention to performance. 3. The CLR of the NET framework manages memory, and garbage collection needs to be used with caution.

Is C# .NET Right for You? Evaluating its Applicability Is C# .NET Right for You? Evaluating its Applicability Apr 13, 2025 am 12:03 AM

C#.NETissuitableforenterprise-levelapplicationswithintheMicrosoftecosystemduetoitsstrongtyping,richlibraries,androbustperformance.However,itmaynotbeidealforcross-platformdevelopmentorwhenrawspeediscritical,wherelanguageslikeRustorGomightbepreferable.

C# .NET and the Future: Adapting to New Technologies C# .NET and the Future: Adapting to New Technologies Apr 14, 2025 am 12:06 AM

C# and .NET adapt to the needs of emerging technologies through continuous updates and optimizations. 1) C# 9.0 and .NET5 introduce record type and performance optimization. 2) .NETCore enhances cloud native and containerized support. 3) ASP.NETCore integrates with modern web technologies. 4) ML.NET supports machine learning and artificial intelligence. 5) Asynchronous programming and best practices improve performance.

See all articles