Azure   发布时间:2019-11-03  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了在 Azure 上部署 Asp.NET Core Web App大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

studio 创建一个 Asp.net Core demo 应用,然后把这个 demo 应用部署到 Azure Web App。通过阅读本文,您将能了解到如何创建 Asp.NET Core 应用程序和如何在Azure上创建 Web App 并部署 Asp.NET Core 应用。

studio 创建 Asp.net Core 应用需要先安装 .net core vs tool,详细信息请参https://www.microsoft.com/net/core#windows" target="_blank">这里。下面我们先创建一个 Asp.NET Core demo 应用。ASP.NET Core Web Application (.NET CorE) 模板。

title="在 Azure 上部署 Asp.NET Core Web App" alt="在 Azure 上部署 Asp.NET Core Web App" src="https://cn.js-code.com/res/2019/02-09/09/9a2f4270a0c7ceb6b755075ee7a4905e.png" >

E) 对话框中选择 “Web Application” 模板。然后修改 Authentication 的类型为 “Individual User Accounts” 。此时通过模板创建的应用就会包含用户管理的模块。同时取消 “Host in the cloud” 的选项,然后点击 OK 按钮。

title="在 Azure 上部署 Asp.NET Core Web App" alt="在 Azure 上部署 Asp.NET Core Web App" src="https://cn.js-code.com/res/2019/02-09/09/7d1cb656de64a92dcd1f665e243304a9.png" >

在本地运行 demo 应用,点击 “Register” 去注册一个新的用户。当您填完信息并按下 “Register” 按钮后会收到下面的错误:

title="在 Azure 上部署 Asp.NET Core Web App" alt="在 Azure 上部署 Asp.NET Core Web App" src="https://cn.js-code.com/res/2019/02-09/09/a20e0f70c84e7f777b0430d476a477f3.png" >

意思是说数据库没有设置好,解决的办法也都在上面说了,一共有三种:studio 的 Package Manager Console 中执行 “update-Database” 命令。update 命令。

title="在 Azure 上部署 Asp.NET Core Web App" alt="在 Azure 上部署 Asp.NET Core Web App" src="https://cn.js-code.com/res/2019/02-09/09/f1700a29c819c73c6aa681d6ebea6a14.png" >

然后重新启动网站并注册新用户,一切 OK!

studio 在发布应用的过程中直接创建 Azure Web App。下面我们将通过演示介绍使用 Visual studio 创建 Azure Web App 的详细步骤。

title="在 Azure 上部署 Asp.NET Core Web App" alt="在 Azure 上部署 Asp.NET Core Web App" src="https://cn.js-code.com/res/2019/02-09/09/c45a18fb2a42d7594e2a2a06bed70f36.png" >

登录完成后点击 new 按钮开始创建过程:

title="在 Azure 上部署 Asp.NET Core Web App" alt="在 Azure 上部署 Asp.NET Core Web App" src="https://cn.js-code.com/res/2019/02-09/09/ed52859abcd7f330c0b9400837158626.png" >

service 类型就是 Web App,所以不需要再进行配置。下面选择或者创建 resource Group/App service Plan。这里稍微解释一下,resource Group 是资源管理的逻辑单位,可以通过 resource Group 管理其包含的资源,主要是进行授权。App service Plan @R_626_10944@就是管理您的资源分配,您花费一块钱和十块钱显然是会分配到不同的资源。然后点击“Explore additional Azure services”开始创建数据库。

title="在 Azure 上部署 Asp.NET Core Web App" alt="在 Azure 上部署 Asp.NET Core Web App" src="https://cn.js-code.com/res/2019/02-09/09/7f738623e13b9eba39b75555097e52e0.png" >

616@中用到了数据库,所以需要在 Azure 上创建数据库。现在进入数据库创建流程,点击右侧绿色的加号:

title="在 Azure 上部署 Asp.NET Core Web App" alt="在 Azure 上部署 Asp.NET Core Web App" src="https://cn.js-code.com/res/2019/02-09/09/2d5db47e7652b511d6e88af964162fae.png" >

在数据库服务器上创建数据库实例。

title="在 Azure 上部署 Asp.NET Core Web App" alt="在 Azure 上部署 Asp.NET Core Web App" src="https://cn.js-code.com/res/2019/02-09/09/9fa0335c73b4ef65268613fe09e94d86.png" >

用户名和密码,然后点击 OK 按钮:

title="在 Azure 上部署 Asp.NET Core Web App" alt="在 Azure 上部署 Asp.NET Core Web App" src="https://cn.js-code.com/res/2019/02-09/09/3e8fedf083558b85723817a824e4df02.png" >

title="在 Azure 上部署 Asp.NET Core Web App" alt="在 Azure 上部署 Asp.NET Core Web App" src="https://cn.js-code.com/res/2019/02-09/09/5cb7781016edfb9b7bb74a7dfc761cc9.png" >

title="在 Azure 上部署 Asp.NET Core Web App" alt="在 Azure 上部署 Asp.NET Core Web App" src="https://cn.js-code.com/res/2019/02-09/09/82f7a9fc28aa5e613c456e9afc3f20e2.png" >

创建后我们回到部署过程。在 Connection 选项卡中,其实我们看到的设置都是默认值,没有特殊要求的话是不需要修改的。点击进入setTings 选项卡:

title="在 Azure 上部署 Asp.NET Core Web App" alt="在 Azure 上部署 Asp.NET Core Web App" src="https://cn.js-code.com/res/2019/02-09/09/f3dfeec3194480149a381a48fee72458.png" >

title="在 Azure 上部署 Asp.NET Core Web App" alt="在 Azure 上部署 Asp.NET Core Web App" src="https://cn.js-code.com/res/2019/02-09/09/4cfc9a83b9168f9951befde1b09882a0.png" >

616@有一个很重要的功能:可以创建用户并且登录。在完成发布后您一定很想测试一下这个功能,因为我们并没有为创建这个功能做过什么。一个新的用户 tester@163.com:

title="在 Azure 上部署 Asp.NET Core Web App" alt="在 Azure 上部署 Asp.NET Core Web App" src="https://cn.js-code.com/res/2019/02-09/09/7cbe2c9877f6955efce474dac228785e.png" >

service 部署的过程。希望对有兴趣的同学有所帮助。

大佬总结

以上是大佬教程为你收集整理的在 Azure 上部署 Asp.NET Core Web App全部内容,希望文章能够帮你解决在 Azure 上部署 Asp.NET Core Web App所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: