azure - UserSecretsId 阻止将 F# ASP.NET Core 应用程序部署到 Azure 应用服务

标签 azure f# azure-web-app-service

我正在尝试将 F# ASP.NET Core 应用部署到 Azure 应用服务。不幸的是,每次我尝试部署时,都会出现 <UserSecretsId>元素已添加到我的项目文件中,如所解释的 in this article导致构建失败并出现以下错误:

A function labeled with the 'EntryPointAttribute' attribute must be the last declaration in the last file in the compilation sequence

本文解释了发生错误的原因,并指示通过从项目文件中删除该元素并在 AssemblyInfo.fs 中添加用户 secret ID 来修复该错误。 。我已经尝试过这个,然后可以手动构建,但是每次我尝试部署时,部署过程仍然会添加 <UserSecretsId>我的项目文件中具有新 ID 的元素,导致构建失败。

有什么方法可以将 F# ASP.NET Core 应用程序发布到 Azure 应用服务吗?

(还报道了Microsoft/visualfsharp#5549)

最佳答案

将其添加到您的 .fsproj 文件中以抑制属性生成。

<PropertyGroup>
 <GenerateUserSecretsAttribute>false</GenerateUserSecretsAttribute>
</PropertyGroup>

如果您想使用用户 secret ,则需要手动添加 UserSecrets 程序集属性。

module Your.Namespace.AssemblyInfo
open Microsoft.Extensions.Configuration.UserSecrets
[<assembly: UserSecretsIdAttribute("Your UserSecretsId")>]
do()

此外,在 ASP.NET Core 2.2 中应该不需要此解决方法。请参阅https://github.com/aspnet/Configuration/pull/872

关于azure - UserSecretsId 阻止将 F# ASP.NET Core 应用程序部署到 Azure 应用服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51979892/

相关文章:

c# - .Net 中可用的并行技术

f# - 如何通过 F# 在函数中创建可变参数?

azure - 创建应用程序服务域需要哪种架构?

c# - Azure 中的 ASP.Net 应用程序缓存 "Web App"

Python "FileHandler"到 Azure Blob 存储 - 没有这样的事情吗

azure - Microsoft Graph API 与 IMAP/POP3 - 哪个更适合阅读邮件?

azure - 网站贡献者无法根据 Azure RBAC 管理 SSL 证书 : Built-in roles

azure - 如何使用应用程序洞察来捕获物联网边缘设备日志?

f# - 如何在 F# 中的 Seq、List 或 Array 中找到 max 的索引

wordpress - 尝试找出为什么我的 Azure 网站停止提供页面