我遵循了微软在 Azure Kubernetes 服务 (AKS) 上部署 HTTPS 入口控制器的这篇文档,并成功部署了一个带有 nginx 入口控制器的托管 Kubernetes 集群 (AKS)。它按预期与 https 一起使用。
但是,响应格式为subdomain.eastus2.cloudapp.azure.com 的域。但是我想使用我自己的自定义域www.somedomain.com。然后我在我的自定义域中添加一个 CNAME 条目,指向 kubernetes 集群配置的公共 IP 地址。
但是,当我这样做时,我在浏览器上收到了响应
默认后端 - 404
看起来我需要更改 Azure(或某处)中的公共 ip 地址,以便它了解它将被自定义域以及 azure 子域使用。
我看过命令:
az网络
命令。但是,目前还不清楚这是否是正确使用的命令。有谁知道我如何进行所需的更改,以便我的自定义 FQDN 可以正确路由到我的 kubernetes 集群?
谢谢
我有一个使用.NET Standard 2.0的跨平台(iOS和Android)Xamarin解决方案.该解决方案由Visual Studio 2017构建(我已尝试过当前版本和预览版本).Forms和Android项目构建良好.但是,iOS无法构建,出现以下错误:
1> CSC:错误CS1703:已导入具有等效标识的多个程序集:'C:\ Users \newuser.nuget\packages\system.reflection.emit\4.3.0\ref \netstandard1.1\System.Reflection.Emit. dll'和'C:\ Program Files(x86)\ Microsoft Visual Studio\Preview\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Facades\System.Reflection.Emit.dll'.删除其中一个重复的引用.
我已经尝试了很多解决方法,如下所述:
不幸的是,这些建议都不起作用 我还尝试直接将System.Reflection.Emit nuget包添加到Forms和/或iOS项目中.这也不起作用.请注意,最初,System.Reflection.Emit包未被解决方案中的任何内容直接引用.它由以下显式引用的nuget包引入:
最后,我在包控制台中尝试了update-package -reinstall命令,以重新安装iOS项目的所有包.这也不起作用.
- 更新
为了清楚说明,Xamarin Forms或Xamarin iOS项目都不直接引用System.Reflection.Emit.该软件包作为其他nuget软件包的依赖项被引入,只是从安装到Xamarin Forms项目中的软件包中获取.我已经确认Nuget引用的所有依赖项都使用相同的版本.看这些截图:
在我看来,问题(如错误所示)是由Visual Studio安装的旧版本的System.Reflection.Emit.但是,我找不到忽略它的方法,而是使用System.Reflection.Emit的版本.正如我上面所说,我曾尝试在Xamarin.iOS项目中使用project.json文件,并手动忽略,但这不起作用.
有没有人有任何想法?
顺便说一句,我注意到这个错误仍然对Xamarin开放.
我有一个 Azure FrontDoor 设置作为在端口 5443 上运行的容器和自定义域之间的反向代理/负载均衡器。这样做的目的是为用户提供一个标准的地址。即https://oursite3.example.com指向container.azurecontainer.io:3443 。
同一个 aci 正在运行多个容器:
container.azurecontainer.io:443
container.azurecontainer.io:2443
container.azurecontainer.io:3443
Run Code Online (Sandbox Code Playgroud)
https://oursite1.example.com
https://oursite2.example.com
https://oursite3.example.com
Run Code Online (Sandbox Code Playgroud)
然后,我们在全球不同区域部署了多个 aci(因此使用 Frontdoor 在不同实例之间进行负载平衡)。
在此示例中,container.azurecontainer.io:3443 安装了 MS AD 身份验证。单击链接后,用户会重定向到登录,并生成一个链接并将浏览器重定向到该链接。该链接中包含redirect_uri。类似于: https: //login.microsoftonline.com/00000000-0000-0000-0000-000000000001/oauth2/authorize ?client_id=00000000-0000-0000-0000-000000000002&redirect_uri=https%3A%2F%2Foursite3.example.com %3A3443%2Fsignin-oidc&response_type=id_token&scope=openid%20profile&response_mode=form_post&nonce=jkalksdfj alskdjflkjalksdfjalkjA&x-client-SKU=ID_NETSTANDARD2_0&x-client-ver=5.5.0.0
但是,登录后,用户会在网站上看到以下内容:
AADSTS50011:请求中指定的回复 URL 与为应用程序配置的回复 URL 不匹配:“00000000-0000-0000-0000-000000000003”
原因是 AD 应用程序的回复 url 设置为:
https://oursite3.example.com/signin-oidc
Run Code Online (Sandbox Code Playgroud)
但是,仔细检查后,用户登录时重定向到的 url 包含此作为 redirect_uri:
https://oursite3.example.com:5443/signin-oidc
Run Code Online (Sandbox Code Playgroud)
即端口 5443 已添加到主机名的末尾。
本质上,它包括了redirect_uri 中的底层原始端口,这是我不希望看到的。
我尝试在我们的网站中使用 ForwardedOptions 。例如,我们的startup.cs文件包含以下内容(ConfigureServices):
services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor |
ForwardedHeaders.XForwardedProto;
// Only loopback proxies are allowed by default.
// Clear that restriction …Run Code Online (Sandbox Code Playgroud) 我有一个 Azure 资源组,其中两个应用服务 Web 应用程序部署在不同的位置并按预期工作。我也有一个 Front Door 配置设置。通过azurefd.net地址访问时,这是按预期响应的。
我想向此配置添加自定义域。首先,我CNAME在我的 DNS 中创建了一个www地址。
然后我添加了一个简单的自定义域配置(通过 ARM 模板),将完全限定的自定义域名作为参数传递。
通过模板部署时,前端部分如下所示:
"frontendEndpoints": [
{
"name": "frontendEndpoint1",
"properties": {
"hostName": "[concat(parameters('frontDoorName'), '.azurefd.net')]",
"sessionAffinityEnabledState": "Enabled",
"sessionAffinityTtlSeconds": 0
}
},
{
"name": "frontendEndpoint2",
"properties": {
"hostName": "[parameters('customDomainName')]",
"sessionAffinityEnabledState": "Enabled",
"sessionAffinityTtlSeconds": 0
}
}
],
Run Code Online (Sandbox Code Playgroud)
前端按预期部署,我仍然可以访问该azurefd.net地址。
但是,当我尝试访问该www地址时,我在浏览器中收到一条错误消息:
我们的服务目前不可用。我们正在努力尽快恢复所有服务。请尽快回来查看。0tEdHXAAAAAADUxvBayGtQLDTjRthnz9XTE9OMjFFREdFMDMyMQBFZGdl
我已经等了半个多小时才能推出任何 DNS 更改,但它仍然不起作用。
可能是什么问题?排除此类错误的简单方法是什么?需要明确的是,我还没有在这个配置中添加任何 HTTPS 证书。Web 应用程序确实响应 HTTP 和 HTTPS,所以希望这不是问题。
我尽可能地遵循 AzureAD aspnetcore 示例,尝试在我们的 aspnetcore 2.2 webapp 中实现 Azure AD 身份验证。我可以使用 Azure AD 成功登录。但是,登录后不会显示用户名。
https://github.com/Azure-Samples/active-directory-b2c-dotnetcore-webapp
该值应该从 User.Identity.Name 属性的视图中读取。
在进一步检查中,我可以看到主要索赔已正确返回到应用程序。但是,由于某种原因 HttpContext.User 对象未正确填充。我不知道为什么会这样。当我从上面的示例中查看相同的值时,HttpContext 设置正确。为了澄清起见,我已经实现了 OnSecurityTokenValidated 处理程序并使用了以下上下文:
可以看出, userPrincipal 具有预期的声明。
但是,httpContext 没有声明。因此 User.Identity.Name 也为空:
我试图进行手动登录,但这也不起作用:
private async Task SignInUser(TokenValidatedContext tokenValidatedContext)
{
var httpContext = tokenValidatedContext.HttpContext;
var userPrincipal = tokenValidatedContext.Principal;
await httpContext.SignOutAsync(AppSettings.CookieName);
await httpContext.SignInAsync(AppSettings.CookieName, userPrincipal,
new AuthenticationProperties
{
ExpiresUtc = DateTime.UtcNow.AddDays(1),
IsPersistent = false,
AllowRefresh = false
});
}
Run Code Online (Sandbox Code Playgroud)
更新
我正在设置 NameClaimType,如上所示。NameClaimType 在配置中设置
任何人都知道我做错了什么?
我正在使用 Visual Studio 2017 和 aspnetcore 2.2 库。我已将 Microsoft.Identity.Client 升级到 …
c# httpcontext claims-based-identity azure-ad-b2c asp.net-core
我尝试使用 Serilog 从 dotnet 6.0 控制台应用程序登录到控制台和 Azure 应用程序见解。我正在从 appsettings.json 文件加载配置。
但是,在启动时,我收到异常:
An unhandled exception of type 'System.InvalidOperationException' occurred in Serilog.Settings.Configuration.dll: 'Type Serilog.Sinks.ApplicationInsights.Sinks.ApplicationInsights.TelemetryConverters.TraceTelemetryConverter, Serilog.Sinks.ApplicationInsights was not found.'
at Serilog.Settings.Configuration.StringArgumentValue.ConvertTo(Type toType, ResolutionContext resolutionContext)
at Serilog.Settings.Configuration.ConfigurationReader.<>c__DisplayClass21_2.<CallConfigurationMethods>b__3(<>f__AnonymousType9`2 <>h__TransparentIdentifier0)
at System.Linq.Utilities.<>c__DisplayClass2_0`3.<CombineSelectors>b__0(TSource x)
at System.Linq.Enumerable.SelectListPartitionIterator`2.ToList()
at Serilog.Settings.Configuration.ConfigurationReader.CallConfigurationMethods(ILookup`2 methods, IList`1 configurationMethods, Object receiver)
at Serilog.Settings.Configuration.ConfigurationReader.Configure(LoggerConfiguration loggerConfiguration)
at Serilog.Configuration.LoggerSettingsConfiguration.Settings(ILoggerSettings settings)
Run Code Online (Sandbox Code Playgroud)
我从 Serilog 网站和其他地方的各种示例中选取了代码。谁能看到我的代码有什么问题吗?
我这里有一个示例程序,可以构建和演示遇到的问题:
https://github.com/ossentoo/testlogger
程序.cs
// See https://aka.ms/new-console-template for more information
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Serilog;
IServiceProvider _serviceProvider;
ILogger<Program> _logger;
Console.WriteLine("Hello, World!");
var config …Run Code Online (Sandbox Code Playgroud) asp.net-core ×2
c# ×2
azure ×1
azure-ad-b2c ×1
azure-aks ×1
dns ×1
httpcontext ×1
kubernetes ×1
serilog ×1
xamarin.ios ×1