由于Microsoft几天前发布了针对Azure Functions的.NET Core 2.0,我试图了解如何在面向.NET Core的VS2017中创建一个新的Functions项目.
我已经尝试了很多配置,但最终仍然使用.NET 4.7.
有没有人设法创建一个针对.NET Core的新功能?
谢谢.
我正在尝试将在 .NET 3.1 上完美运行的 Azure Function 迁移到 .NET 5。我遵循了 Microsoft 的 GitHub 指南,但仍然无法让它在本地运行或调试(甚至没有尝试发布到 Azure)。
我收到此错误:
[2021-09-05T09:49:33.066Z] A host error has occurred during startup operation 'bb37a6db-b6f4-4396-bb9b-cb5ae0bba387'.
[2021-09-05T09:49:33.067Z] Microsoft.Azure.WebJobs.Script: Did not find functions with language [dotnet-isolated].
Run Code Online (Sandbox Code Playgroud)
并且正在引发此异常:
这是我的 Program.cs:
static async Task Main(string[] args)
{
var host = new HostBuilder()
.ConfigureAppConfiguration(c =>
{
c.AddCommandLine(args);
})
.ConfigureServices(s =>
{
s.AddLogging();
})
.Build();
await host.RunAsync();
}
Run Code Online (Sandbox Code Playgroud)
这是我的项目文件:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
<UserSecretsId>76d0a5ed-221b-4b35-8ff4-3ee33d393196</UserSecretsId>
<OutputType>Exe</OutputType>
<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
</PropertyGroup>
<ItemGroup>
<None Remove="global.json" />
</ItemGroup>
<ItemGroup>
<Content Include="global.json"> …
Run Code Online (Sandbox Code Playgroud) 我正在尝试生成由存储在 Azure KeyVault 中的密钥对自签名的证书。
我的最终结果是带有无效签名的证书:
生成证书参数:
DateTime startDate = DateTime.Now.AddDays(-30);
DateTime expiryDate = startDate.AddYears(100);
BigInteger serialNumber = new BigInteger(32, new Random());
X509V1CertificateGenerator certGen = new X509V1CertificateGenerator();
X509Name selfSignedCA = new X509Name("CN=Test Root CA");
certGen.SetSerialNumber(serialNumber);
certGen.SetIssuerDN(selfSignedCA); //Self Signed
certGen.SetNotBefore(startDate);
certGen.SetNotAfter(expiryDate);
certGen.SetSubjectDN(selfSignedCA);
Run Code Online (Sandbox Code Playgroud)
获取对 Azure KeyVault 存储密钥的引用(类似 HSM 的服务):
//Create a client connector to Azure KeyVault
var keyClient = new Azure.Security.KeyVault.Keys.KeyClient(
vaultUri: new Uri("https://xxxx.vault.azure.net/"),
credential: new ClientSecretCredential(
tenantId: "xxxx", //Active Directory
clientId: "xxxx", //Application id?
clientSecret: "xxxx"
)
);
var x …
Run Code Online (Sandbox Code Playgroud) 我想固定我的完全托管的 Google Cloud Run 集群的证书。
我可以固定 Google 生成的 SSL 证书,但我不知道我是否可以依靠它们来保留相同的证书,直到它过期,而且我无法为客户端准备他们将生成的未来 SSL 证书,因为我不是在 Google 自动安装它们之前就知道它们。
换句话说,他们的软件可能会偶尔重新生成它以进行优化或其他一些内部逻辑。
是否有其他解决方案(不包括签署每个回复)?
谢谢
我目前正在为ASP.NET Core WebAPI项目运行docker容器。该Web服务当前在端口80上公开。
我的dockerfile看起来像这样:
FROM microsoft/dotnet:2.1-aspnetcore-runtime
ARG source
WORKDIR /app
EXPOSE 80
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "testapi.dll"]
Run Code Online (Sandbox Code Playgroud)
我想将Nginx安装为服务和公开的公共网络之间的一层。
最终结果应该是在仅内部端口90上运行的ASP.NET,以及将本地90转发到公共80端口的Nginx Web服务器。
这可能吗?如果是这样,我如何实现这种架构?顺便说一句,我完全知道由额外的层引起的开销。
谢谢!