[Release program of IIS tutorial] Realize visual studio publishing website to IIS website on the server

[Release program of IIS tutorial] Realize visual studio publishing website to IIS website on the server

Introduction:

After writing the code in the visual stuido environment, we are faced with a problem, how to publish the code on the IIS website built on the server. What should we consider?

1. How to build an IIS website

Everyone knows that we are going to publish the code to a website and run it. Then we definitely need a site. What platform does this site depend on? I think when we write in visual studio, we know that we need to configure the IIS environment and build an IIS environment site.

Step 1
into the Control Panel -> Programs -> Enable or disable Windows features

2 Find Internet Information Services and tick it, and select everything that IIS needs to install. Very detailed Web server construction (IIS)

The construction of windows Server 2012 and windows system are explained in detail.

3 After setting up, we need to mount our site under IIS . There are generally two ways. One is to create a new site directly and set different ports. One is to open a new virtual directory under a certain site and configure a new path under the site.

Complete the following picture #### (the picture is temporarily missing, the company s intranet is not allowed to upload pictures. Next time you get a server for yourself)

2

Visual studio 2017 releases the program to a certain site

After confirming that your site has been successfully created, you can publish your program through visual studio. it's actually really easy. Proceed as follows:

1 Right-click to select your project and select Publish

2 Select Folder, select your release to the site after the corresponding folder click Post.

3

The highlight! If you are doing this for the first time then there are likely to be many mistakes! For example, 404 500 may prompt you that the compilation was unsuccessful.

but! ! !

Don't worry. Let me speak slowly.

1 Check your application pool under the IIS configuration. What version of the .net Framework has been selected? Generally, we often choose to integrate when publishing Web api.

2 You make sure that your web config in your visual studio project does not modify any attributes! ! ! Anyway, I am silly and fufu changed some configurations. It is very likely that a lot of problems have arisen because of your random changes.

3 Confirm what version of the IIS configuration on the server you publish to. Is it .net 2.0 or 3.5 or 4.0 or 4.5. Look at the version of targetFramework in your own web config. What is the Framework version of the properties in your project. Don't be foolish to use 4.6 to publish on 4.0 or 3.5 2.0. Another point is that framework4.0 is compatible with the version of framework4.5.

If there is a problem with the compilation, do not change your web config easily. The most likely reason is that the version of your .net Framework is not compatible or the IIS installation is not complete. You can try to open cmd (administrator rights) according to whether your system is 64bit or Enter the 32bit command line to register and re-register IIS:

If you do not follow the normal order of installing iis first and then .net, you can use this command to re-register: (The following test is in the version of .net 4.0)

32-bit Windows :

  1. Run->cmd

cd  C:\Windows\Microsoft.NET\Framework\v4.0.30319
 
aspnet_regiis.exe -i
 

64-bit Windows :

  1. Run->cmd

cd  C:\Windows\Microsoft.NET\Framework64\v4.0.30319
 
aspnet_regiis.exe -i
 

If you are prompted to install a higher version, congratulations, the problem is coming hahahahaha.

I found a very useful blog. The bread inside covers the problems you may encounter. This is the portal (eye in)


...

I will sort out the problems encountered in the next blog when I have time.

Remarks: The pictures will be sorted up at that time. I'm so angry with the company's intranet.