This article is a mirror article of machine translation, please click here to jump to the original article.

View: 15139|Reply: 3

[Communication] C# on DevCloud

[Copy link]
Posted on 12/12/2018 4:23:36 PM | | |
                      1Overview
1.1 Purpose of the article
This article introduces how to use software development services (DevCloud) to complete the development of a C# web project through an example.
1.2 Project Details



1. Project Name: Super Cold Joke Website
2. Project Introduction: A website that contains functions such as user login and registration and browsing jokes.
3. Development Programming Language: ASP.NET MVC5 (C#)
4. Project type: Web project based on ASP.NET B/S architecture
5. Deployment environment: Windows + IIS + MySql
6. Deployment method: Ansible deployment + playbook script




In a typical B/S architecture system, the user accesses the system through the Internet, and the client processes the user's operations and reads or writes data to the database.
1.3 Backbone process
The main processes of this article are: code hosting, compilation and build, release (software release library), and deployment.
Developers use code hosting services for version management after local development. After the project is developed to a certain extent, it can be compiled and built, and the software package can be built and archived through the release service. The package is then deployed to the server and accessed externally.



1.4 Prerequisites
1. Register a HUAWEI CLOUD account: Register a HUAWEI CLOUD account on the HUAWEI CLOUD official website, which is applicable to all HUAWEI CLOUD products.
2. ECS: ECS with public IP will be used for deployment (Windows Sever 2012).
2 Project management
2.1 Create a project
There are two types of development processes for new projects: scrum process and Kanban process. The scrum process is a standard agile development process, and the work item hierarchy is the traditional scrum division method Epic->Feature->Story->Task&Bug.



2.2 Create an iteration
The R&D cycle of this project is short, with only one release, divided into three iterations, and the iteration cycle is one week.




2.3 Sort out the list of product requirements
Project planning is to display the hierarchical structure of work items in the form of a mind map, more intuitively see the parent-child relationship, after creating a new work item in the project planning, it will be automatically generated to the later Epic, Feature, Backlog and iteration pages, before the start of the iteration, the project manager will implement all the demand information obtained from the customer into the project plan one by one, decompose it into a story, and set priorities for the work item.




3 codeHosting
3.1 Create a repository
Ø When creating a new code repository, select "Create Template", enter the name of the repository that has been exposed as a sample template in the search box, and select the template. (Search for "superjokes" here, programming language selection ASP.NET)



Enter the new repository name (which can be the same name as the template repository) to create a code repository



Database password modification:(Required, otherwise the deployment will not be successful)
Modify the appsettings.config in the superjokes/src/Joke.Web/App_Data directory. Change the password in the database configuration (line 33 Password=) to the database password on the host to be deployed.



4 Compile build
4.1 Create a build task
Ø Create a new task, check msbuild on the "Select Build Template" screen, and click OK to complete the creation of the task template. Jump to the "Compile Build Tasks" screen.




Ø Enter the build details
Task description, source code repository branch, etc. are optional.



Ø Msbuild build
Msbuild build process, using the image msbuild15-all



Enter the command:



Command Notes:
Since the SLN file path of this code project is located in the /src directory, the cd src command is executed first on the command line.



5 released
In this project, the publishing service can upload the executable files generated by the build to the release repository for easy package management.
Ø Version archiving
The corresponding compression instructions have been written during the Msbuild build process.
After specifying the build package path, release version number, and package name in the Upload package to release repository (Windows environment) step, you can upload the built package to the release repository for automatic software version management.



6 deployment
The purpose of the deployment task is to deploy the built package to a server that we can access, and once the deployment is successful, the address can be accessed through a browser.
The deployment task is divided into four parts, namely host credit, writing deployment scripts, task configuration, and executing deployment.



Since the web project is written in C#, the server needs to be a Windows server with an elastic IP address.
Before the host is granted, the host environment needs to be configured accordingly.
6.1 Host environment configuration
1. Install MySQL.
2. Generate a MySQL database on the server using the database configuration script, which is a superjokes.sql located in the root directory of the code repository.




6.2 Host Credit
Grant the server host to DevCloud for deploying websites.
6.3 Deploy scripts
Execute powershell commands via playbook scripts to deploy the project to the server's IIS service.
Ø Get the deployment script
Obtain the playbook script from the root directory of the code repository IIS-windows-1.0.zip and upload it to the playbook management in DevCloud.
6.4 Task configuration
Ø Create a new non-template deployment task.
Fill in the deployment task name, select Ansible Deployment for Deployment Settings, select Custom Playbook for the template, and select the playbook script you uploaded.




Then select the server to deploy, set the port, select the package to deploy and set the default page for the website.




Playbook parameters explained in detail:
webapps_path: The package deployment path, the path on the target host
app_filename: The name of the package used for the deployment
sitePort: 网站端口(提供一个目标主机上可访问的端口号)
SiteName: 网站名称,启动IIS服务时为该网站命名
SiteAppPoolsModel: Integrated 不必修改
managedRuntimeVersion: v4.0 不必修改
WebSitePath:  IIS服务中网站源文件路径
IISLogFile:  IIS服务中的日志存储路径
win_curl_path: No need to modify
6.5 View the deployment effect
After the deployment task is executed, you can access the website using the http://ip: Port/Default page




At this point, we have completed the construction of the C# web project on DevCloud.
         
        





Previous:ASP.NET MVC website performance optimization
Next:Install the elasticsearch-6.5.2 elasticsearch-head plugin
Posted on 12/13/2018 8:57:56 AM |
DevCloud is an R&D cloud platform that integrates Huawei's R&D practices, cutting-edge R&D concepts, and advanced R&D tools.
Provide developers with R&D tool services to make software development simple and efficient.
Posted on 12/13/2018 9:01:27 AM |
Look at the code onboarding process like Jenkins + Gitlab + Ansible--playbook
Posted on 12/13/2018 3:16:11 PM |
Remote pictures can't be loaded
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com