网络核心应用。我正在尝试使用自动映射器,但导致以下错误。
Run Code Online (Sandbox Code Playgroud).Net Core Automapper missing type map configuration or unsupported mapping
我在startup.cs中有以下设置
var mappingConfig = new MapperConfiguration(mc =>
{
mc.AddProfile(new MappingProfile());
});
IMapper mapper = mappingConfig.CreateMapper();
services.AddSingleton(mapper);
Run Code Online (Sandbox Code Playgroud)
然后我使用配置文件。
public class MappingProfile : Profile
{
public MappingProfile()
{
this.CreateMap<Geography, GeographyEntity>();
this.CreateMap<Model1, Model2>();
}
}
Run Code Online (Sandbox Code Playgroud)
我正在使用自动映射器如下
Model1 model = this.Mapper.Map<Model1>(Model2);
Run Code Online (Sandbox Code Playgroud)
下面是型号
public partial class Model1
{
public int SNo { get; set; }
public string SarNo { get; set; }
public string SiteName { get; set; }
public string Client { get; …Run Code Online (Sandbox Code Playgroud) 网络核心应用。我添加了 azure 广告身份验证。下面是我的 startup.cs 文件
services.AddAuthentication(x =>
{
x.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
x.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
})
.AddJwtBearer(options =>
{
options.SaveToken = true;
options.RequireHttpsMetadata = true;
options.Authority = $"{authSettings.Authority}/{authSettings.TenantId}";
options.Audience = authSettings.ClientId;
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateAudience = true,
ValidateLifetime = true,
ValidateIssuer = true,
ValidateIssuerSigningKey = false,
ValidateActor = false,
};
});
Run Code Online (Sandbox Code Playgroud)
我已将应用程序部署到 azure 应用程序服务。它部署成功。我打开swagger并进行身份验证并尝试点击api。它抛出了我 500 错误。我去了 azure 应用服务日志流。它向我显示以下错误消息。
/appsvctmp/volatile/logs/runtime/0ad1b1161bafbb0b8662db769e40eca0226d3d1d7d4737bdbe13f88e8a4f089b.log
2020-07-18T03:48:32.615339369Z: [INFO] Hosting environment: Production
2020-07-18T03:48:32.615384568Z: [INFO] Content root path: /app
2020-07-18T03:48:32.616251458Z: [INFO] Now listening on: http://[::]:8081
2020-07-18T03:48:32.616952250Z: [INFO] Application …Run Code Online (Sandbox Code Playgroud) 嗨,我正在编写 ARM 模板来部署我的应用程序服务。我想在我的 arm 模板中创建系统标识。在应用程序服务臂模板部分,我有以下代码。
"identity": {
"principalId": "[reference(variables('identity_resource_id'), '2017-12-01', 'Full').identity.principalId]",
"tenantId": "[parameters('tenantId')]",
"type": "SystemAssigned"
}
Run Code Online (Sandbox Code Playgroud)
然后在可变部分我添加
"appServiceNameFrontEnd": "[concat(variables('defaultConvention'),'03-','FrontEnd')]"
"identity_resource_id": "[concat(resourceId('Microsoft.Web/sites', variables('appServiceNameFrontEnd')), '/providers/Microsoft.ManagedIdentity/Identities/default')]"
Run Code Online (Sandbox Code Playgroud)
每当我尝试运行它时,我都会收到以下错误
##[错误]部署模板验证失败:'1'行和'10436'列的模板资源'FrontEnd'无效:此位置不需要模板函数'reference'。请参阅 https://aka.ms/arm-template-expressions了解使用详情..
有人可以帮助我如何获得系统分配的身份吗?任何帮助将不胜感激。谢谢
azure azure-active-directory azure-resource-manager azure-web-app-service