asp.net - Azure WebApp 的起点

标签 asp.net azure azure-web-app-service

我打开了一个新的 .Net Framework WebApp,并将其与 Azure 一起使用。

首先,当我从 Visual Studio 运行应用程序时,它会打开浏览器并显示默认页面:

enter image description here

我正在寻找“主”类或方法,但找不到。我想知道从哪里开始?这东西是如何工作的?

如果添加了一个我想与 WebApp 一起运行的新方法,我应该从哪里调用它?

最佳答案

I am wondering where does it start from? how this thing works?

这是关于asp.net webapp如何运行的。当应用程序启动时,它会运行Global.asax的Application_Start()方法。在这个方法中,你可以将Route对象添加到静态RouteTable.Routes集合。稍后收到每个请求时将检查这些内容。每个 Route 对象定义一个要匹配的 URL 模式以及在本例中要使用的 Controller 。

有关Asp.net webapp如何运行的更多详细信息,您可以引用此article还有这个one .

If added a new method for which I want to run together with the WebApp, where should I call it from ?

当您发布到 azure 并在 Controller 中添加新方法时,您可以像 yourappname.azurewebsites.net/Controllername/methodname 那样调用它。主要看你的Rounte,你可以引用这个article .

<强> Azure App Service Web Apps 是一项用于托管 Web 应用程序、REST API 和移动后端的服务。您可以使用自己喜欢的语言进行开发,无论是 .NET、.NET Core、Java、Ruby、Node.js、PHP 或 Python。应用程序可以在基于 Windows 的环境中轻松运行和扩展。

使用应用服务,您为您使用的 Azure 计算资源付费。您使用的计算资源由您运行 Web 应用的应用服务计划决定。

关于asp.net - Azure WebApp 的起点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53212845/

相关文章:

c# - 获取RequestFailedException : Public access is not permitted on this storage account when accessing Blob Storage in Azure

c# - 在 Controller 类之外获取 IRouter 实例的最简单方法

c# - 如何解决 FileSystemException : Cannot retrieve length of file, path ='...' (OS Error : No such file or directory, errno = 2)

azure - Set-AzureRmDiagnosticSetting : Exception type: CloudException, 消息:不支持指标类别 'AllMetrics'

c# - Azure表存储: maximum variable size?

Azure 网站 PHP API - PUT 和 DELETE 上不允许使用 405 方法

azure - 无法更新 Web 应用程序设置 : Number of Web workers must be greater than zero

asp.net - 在asp.net中设置MIME类型

asp.net - 是否可以有条件地包含 CSS?

c#-4.0 - Gzip 并上传到 Azure blob