Remotely publish a core program ASP.NET IIS Web server on the Internet
- Windows Server
- Windows Server 2019
- Internet Information Services (IIS)
- ASP.NET Core
- Web Deploy
- 3.6 Japanese version
Learn how to upload a ASP.NET Core program directly from Visual Studio to Internet Information Services (IIS) set up on Windows Server.
The first time you need to work on Windows Server, once set up, you can publish directly from Visual Studio after the second time.
This Tips publishes programs to servers on the Internet, but security measures are minimal, so if you are concerned, we recommend that you take additional measures or take another upload method.
- Windows Server has been set up
- Upload ASP.NET Already have a Core program
- Servers can be connected to the Internet or intranet
Set up Internet Information Services (IIS)
See the steps on the following pages: IIS ASP.NET other than running core programs.
By the way, iis setup requires additional settings, but it is not set in the tips linked above. You can set it up later, so we'll talk about that later.
Add managed services in IIS
The default setup for IIS does not set up Managed Services, so add it.
Start Server Manager.
Select Add Roles and Features from menu management.
Press the "Next" button several times to the screen you want.
When you come to the "Select Server Role" screen, expand "Web Server (IIS)" and "Management Tools" and check "Management Services". (The figure is in English, but it is the same.)
ASP.NET 4.7 is not installed, the following dialog is displayed and added together.
Click the "Next" button as it is to install it.
When you open IIS Manager, you can see that administrative services have been added.
The firewall also automatically allows ports for deployment.
ASP.NET Core Hosting Bundle
Required to ASP.NET Core on Windows Server. Installing it allows IIS ASP.NET work like a traditional application.
Go to the following page: By the way, this Tips uses 5.0, so if you use a different version, go to the appropriate page.
At the runtime at the bottom right of the screen, there is a Hosting Bundle for Windows, so click the link to download it.
Run the downloaded installer on Windows Server.
Check "I accept the license terms and conditions" and click the install button.
Close when the installation is complete.
Install Web Deploy
Required to receive publishing programs from Visual Studio.
Go to the link below.
Windows Server has only a basic 64bit, so download the 64-bit version.
Run on Windows Server.
Check "I accept the license agreement" and click "Next".
Click the "Install" button.
When the installation is finished, click the "Done" button.
When you open IIS Manager, Administrative Services Delegation is added.
Application pool settings
ASP.NET .NET CLR is not related for Core, so add an application pool without managed code. You can safely change an existing DefaultAppPool. This setting is not directly related to web deployment, so I won't go into details.
If you added an application pool, set it to a site.
Create a site
Create a site. You can create a new one, or you can use the default Web Site that you have from the beginning. This Tips uses the Default Web Site as is. Creating a site is not directly related to web deployment, so I won't go into details.
Create deployment users
You can also deploy it in a Windows account, but it increases the security risk, so create a dedicated deployment user. If you are deploying with a Windows account, you do not need to set this item.
Start IIS Manager.
Select a server from the left tree and open IIS Manager Users in the central Administration group.
Click Add User on the right.
Create by entering the name and password of the deployment user.
You only added users to IIS, so you need to set permissions for each site. This setting is not required when publishing with a Windows administrator account.
Select the target site from the tree on the left and open IIS Manager Permissions.
Click "User Permissions" from the item on the right.
To specify the user you added to IIS this time, check with IIS Manager and click the select button. Check Windows if you want to publish with a Windows account.
A list of users is displayed, so select it.
Once selected, click the OK button.
Select a server from the left tree to open Administrative Services.
You don't need to do anything if Enable Remote Connection or Windows Credentials or IIS Manager Credentials are checked. If you want to publish with a Windows account, it's OK if Windows Credentials Only is checked.
If it is not checked, check it.
I think that each item is in a state where it is not possible to enter it, so click "Stop" on the right.
Check the required items. When you are done, click on the "Start" link on the right.
There is a setting to increase security at the bottom of this screen, but first of all, it is necessary to confirm that it can be arranged, so I will not do it this time.
Deploy programs from Visual Studio
Go back to your work PC, start Visual Studio ASP.NET open the Core program. This time, we will publish a program with a new project created.
Right-click on the project and select Publish.
Select Web Server (IIS) and click Next.
Select Web Deployment.
Enter the following:
|server||The IP address or DNS name or domain name of the server on which IIS was set. It can be specified on both the Internet or the intranet.|
|Site name||Specifies the site name that has been added to IIS.|
|Destination URL||There is no problem with white space.|
|User name||Specifies the user account for Windows Server or the user name created in IIS.|
|password||Enter the authentication password for the user above.|
|Save password||Save if it is troublesome to enter a password every time you publish it.|
It is created as shown in the figure.
If you have created multiple publishing profiles, you can change them in the drop-down above, but if the names are confusing, you can change them.
You can change the detailed settings on the edit screen.
"Settings" is selected from the left tab. You don't need to change it, but if necessary, change the Configuration, Target Runtime, and File Publishing Options.
"Connect" is selected from the left tab. You're seeing what you entered first, but click on the "Validate Connection" button below.
If you can connect successfully to the publisher, the following dialog will be displayed. Check "Save this certificate for future sessions in Visual Studio" and click the "I agree" button. If saved, this dialog will only be visible for the first time.
If a check mark is displayed on the right side of the connection verification, it will be able to connect normally.
By the way, if it fails, click the link to check the cause and take action depending on the cause.
Common causes include:
- The user name and password are wrong.
- Iis does not allow users. The investigation method is to deploy it once in a Windows administrator.
- The firewall "TCP 8172" is not allowed. Cloud-side permissions are not allowed in clouds such as Azure.
- You have not installed the Web deployment tool in full.
- IIS settings are missing. Please double check this tips.
When you are done, publish with the publish button.
If you succeed in publishing, you're done. It may fail occasionally, so please reissue it or verify the connection.
If you can access it in a web browser ASP.NET the core program is running, you're done.