search
HomeBackend DevelopmentC#.Net TutorialDetailed explanation of the process of publishing ASP.NET website

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>

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
 }
}

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
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
The Community of C# .NET Developers: Resources and SupportThe Community of C# .NET Developers: Resources and SupportMay 06, 2025 am 12:11 AM

The C#.NET developer community provides rich resources and support, including: 1. Microsoft's official documents, 2. Community forums such as StackOverflow and Reddit, and 3. Open source projects on GitHub. These resources help developers improve their programming skills from basic learning to advanced applications.

The C# .NET Advantage: Features, Benefits, and Use CasesThe C# .NET Advantage: Features, Benefits, and Use CasesMay 05, 2025 am 12:01 AM

The advantages of C#.NET include: 1) Language features, such as asynchronous programming simplifies development; 2) Performance and reliability, improving efficiency through JIT compilation and garbage collection mechanisms; 3) Cross-platform support, .NETCore expands application scenarios; 4) A wide range of practical applications, with outstanding performance from the Web to desktop and game development.

Is C# Always Associated with .NET? Exploring AlternativesIs C# Always Associated with .NET? Exploring AlternativesMay 04, 2025 am 12:06 AM

C# is not always tied to .NET. 1) C# can run in the Mono runtime environment and is suitable for Linux and macOS. 2) In the Unity game engine, C# is used for scripting and does not rely on the .NET framework. 3) C# can also be used for embedded system development, such as .NETMicroFramework.

The .NET Ecosystem: C#'s Role and BeyondThe .NET Ecosystem: C#'s Role and BeyondMay 03, 2025 am 12:04 AM

C# plays a core role in the .NET ecosystem and is the preferred language for developers. 1) C# provides efficient and easy-to-use programming methods, combining the advantages of C, C and Java. 2) Execute through .NET runtime (CLR) to ensure efficient cross-platform operation. 3) C# supports basic to advanced usage, such as LINQ and asynchronous programming. 4) Optimization and best practices include using StringBuilder and asynchronous programming to improve performance and maintainability.

C# as a .NET Language: The Foundation of the EcosystemC# as a .NET Language: The Foundation of the EcosystemMay 02, 2025 am 12:01 AM

C# is a programming language released by Microsoft in 2000, aiming to combine the power of C and the simplicity of Java. 1.C# is a type-safe, object-oriented programming language that supports encapsulation, inheritance and polymorphism. 2. The compilation process of C# converts the code into an intermediate language (IL), and then compiles it into machine code execution in the .NET runtime environment (CLR). 3. The basic usage of C# includes variable declarations, control flows and function definitions, while advanced usages cover asynchronous programming, LINQ and delegates, etc. 4. Common errors include type mismatch and null reference exceptions, which can be debugged through debugger, exception handling and logging. 5. Performance optimization suggestions include the use of LINQ, asynchronous programming, and improving code readability.

C# vs. .NET: Clarifying the Key Differences and SimilaritiesC# vs. .NET: Clarifying the Key Differences and SimilaritiesMay 01, 2025 am 12:12 AM

C# is a programming language, while .NET is a software framework. 1.C# is developed by Microsoft and is suitable for multi-platform development. 2..NET provides class libraries and runtime environments, and supports multilingual. The two work together to build modern applications.

Beyond the Hype: Assessing the Current Role of C# .NETBeyond the Hype: Assessing the Current Role of C# .NETApr 30, 2025 am 12:06 AM

C#.NET is a powerful development platform that combines the advantages of the C# language and .NET framework. 1) It is widely used in enterprise applications, web development, game development and mobile application development. 2) C# code is compiled into an intermediate language and is executed by the .NET runtime environment, supporting garbage collection, type safety and LINQ queries. 3) Examples of usage include basic console output and advanced LINQ queries. 4) Common errors such as empty references and type conversion errors can be solved through debuggers and logging. 5) Performance optimization suggestions include asynchronous programming and optimization of LINQ queries. 6) Despite the competition, C#.NET maintains its important position through continuous innovation.

The Future of C# .NET: Trends and OpportunitiesThe Future of C# .NET: Trends and OpportunitiesApr 29, 2025 am 12:02 AM

The future trends of C#.NET are mainly focused on three aspects: cloud computing, microservices, AI and machine learning integration, and cross-platform development. 1) Cloud computing and microservices: C#.NET optimizes cloud environment performance through the Azure platform and supports the construction of an efficient microservice architecture. 2) Integration of AI and machine learning: With the help of the ML.NET library, C# developers can embed machine learning models in their applications to promote the development of intelligent applications. 3) Cross-platform development: Through .NETCore and .NET5, C# applications can run on Windows, Linux and macOS, expanding the deployment scope.

See all articles

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

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)