1,在abp官网下载的模板(asp.net+ef)写Application层的时候需要使用AutoMapper。结果ObjectMapper一直为null

解决:需要在当前项目的Module依赖AbpAutoMapperModule

2,Linq Include扩展方法需要引用EntityFramework.dll

3,ToListAsync扩展方法需要引用using Abp.Linq.Extensions;

4,手动搭建abp2.x老是出现System.Collections.Immutable1.2.1.0找不到

解决:

①编辑项目web.config改为(这个可以不管)

      <dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.1.0" newVersion="1.2.1.0" />
</dependentAssembly>

②编辑项目工程文件(例如Demo.Web.csproj文件)

案例下载:http://pan.baidu.com/s/1kU7By31

5,创建租户(独立数据库)报MSDTC 不可用

解决方案:

打开windows服务开启Distributed Transaction Coordinator服务

6,单元测试时老是报个错:

解决:

单元测试Module需要依赖AbpTestBaseModule

7,运行模板项目报错

解决办法:删除项目下的bin目录,然后重新编译就好了

8, 把Abp.Zero.Common添加到项目报错

解决方法:

在Abp.Zero.Common.csproj文件中删除

9,本地化失效

解决方法:需要把xml设置为嵌入的资源

10,更改提示变成中文 

扩展本地化文件

在Ousutec.Duty.Core中的DutyLocalizationConfigurer的Configure方法加上扩展配置

using Abp.Configuration.Startup;
using Abp.Localization.Dictionaries;
using Abp.Localization.Dictionaries.Xml;
using Abp.Localization.Sources;
using Abp.Reflection.Extensions; namespace Ousutec.Duty.Localization
{
public static class DutyLocalizationConfigurer
{
public static void Configure(ILocalizationConfiguration localizationConfiguration)
{
localizationConfiguration.Sources.Add(
new DictionaryBasedLocalizationSource(DutyConsts.LocalizationSourceName,
new XmlEmbeddedFileLocalizationDictionaryProvider(
typeof(DutyLocalizationConfigurer).GetAssembly(),
"Ousutec.Duty.Localization.SourceFiles"
)
)
); localizationConfiguration.Sources.Extensions.Add(
new LocalizationSourceExtensionInfo("AbpWeb",
new XmlEmbeddedFileLocalizationDictionaryProvider(
typeof(DutyLocalizationConfigurer).GetAssembly(),
"Ousutec.Duty.Localization.AbpWebExtensions"
)
)
);
}
}
}

DutyLocalizationConfigurer

将Abp.Web.Common源码的AbpWeb-zh-Hans.xml复制到Ousutec.Duty.Core项目中。并嵌入资源

11,关于自动注册依赖

约定名称必须一直,例如

using System;
using System.Collections.Generic;
using System.Text;
using Castle.Core.Logging;
using Ousutec.Duty.Common;
using Newtonsoft.Json; using Abp.Dependency;
using Ousutec.Duty.DutyCmds;
using Abp.AutoMapper; namespace Ousutec.Duty.RabbitMqListeners
{
public class DutyCmdListener : IDutyCmdListener, ITransientDependency
{
private readonly ILogger _logger;
private readonly IDutyCmdAppService _dutyCmdAppService;
public DutyCmdListener(ILogger logger, IDutyCmdAppService dutyCmdAppService)
{
_logger = logger;
_dutyCmdAppService = dutyCmdAppService;
} public void ProcessMsg(DutyCmdMessage msg)
{
_logger.Info(JsonConvert.SerializeObject(msg));
_dutyCmdAppService.Add(msg.DutyCmdDtos.MapTo<IEnumerable<Addinput>>());
}
}
}

DutyCmdListener

不一致会 报找不到依赖异常

12,Swagger CustomSchemaIds错误

Conflicting schemaIds: Identical schemaIds detected for types Ousutec.Duty.DutyRecords.AddInput and Ousutec.Duty.DutyDevSettings.AddInput. See config settings - "CustomSchemaIds" for a workaround

解决方法:  options.CustomSchemaIds(t => t.FullName);

            // Swagger - Enable this line and the related lines in Configure method to enable swagger UI
services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1", new Info { Title = "Duty API", Version = "v1" });
options.DocInclusionPredicate((docName, description) => true); options.CustomSchemaIds(t => t.FullName);
// Define the BearerAuth scheme that's in use
options.AddSecurityDefinition("bearerAuth", new ApiKeyScheme()
{
Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"",
Name = "Authorization",
In = "header",
Type = "apiKey"
});
// Assign scope requirements to operations based on AuthorizeAttribute
options.OperationFilter<SecurityRequirementsOperationFilter>();
});

Startup

13,接口返回参数命名,忽略abp框架设置的命名规则

using System;
using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Cors.Internal;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Castle.Facilities.Logging;
using Swashbuckle.AspNetCore.Swagger;
using Abp.AspNetCore;
using Abp.Castle.Logging.Log4Net;
using Abp.Extensions;
using Ousu.DataCollection.Attendance.Authentication.JwtBearer;
using Ousu.DataCollection.Attendance.Configuration;
using Ousu.DataCollection.Attendance.Identity;
using Ousu.DataCollection.Attendance.Common;
using Abp.AspNetCore.SignalR.Hubs;
using Ousu.DataCollection.Attendance.AttendanceCmds;
using Abp.Dependency;
using Castle.Windsor.MsDependencyInjection;
using Aliyun.OSS;
using Castle.Core.Logging;
using Abp.Json;
using Newtonsoft.Json.Serialization;
using Abp; namespace Ousu.DataCollection.Attendance.Web.Host.Startup
{
public class Startup
{
private const string _defaultCorsPolicyName = "localhost"; private readonly IConfigurationRoot _appConfiguration; public Startup(IHostingEnvironment env)
{
_appConfiguration = env.GetAppConfiguration();
} public IServiceProvider ConfigureServices(IServiceCollection services)
{ // MVC
services.AddMvc(
options =>
{
options.Filters.Add(new CorsAuthorizationFilterFactory(_defaultCorsPolicyName));
}
); IdentityRegistrar.Register(services);
AuthConfigurer.Configure(services, _appConfiguration); services.AddSignalR(); // Configure CORS for angular2 UI
services.AddCors(
options => options.AddPolicy(
_defaultCorsPolicyName,
builder => builder
.WithOrigins(
// App:CorsOrigins in appsettings.json can contain more than one address separated by comma.
_appConfiguration["App:CorsOrigins"]
.Split(",", StringSplitOptions.RemoveEmptyEntries)
.Select(o => o.RemovePostFix("/"))
.ToArray()
)
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials()
)
); // Swagger - Enable this line and the related lines in Configure method to enable swagger UI
services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1", new Info { Title = "Attendance API", Version = "v1" });
options.DocInclusionPredicate((docName, description) => true); options.CustomSchemaIds(t => t.FullName);
// Define the BearerAuth scheme that's in use
options.AddSecurityDefinition("bearerAuth", new ApiKeyScheme()
{
Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"",
Name = "Authorization",
In = "header",
Type = "apiKey"
});
// Assign scope requirements to operations based on AuthorizeAttribute
options.OperationFilter<SecurityRequirementsOperationFilter>();
}); //去除abp框架自带的命名规则
services.PostConfigure<MvcJsonOptions>(options =>
{
options.SerializerSettings.ContractResolver = new AbpContractResolver();
}); // Configure Abp and Dependency Injection
return services.AddAbp<AttendanceWebHostModule>(
// Configure Log4Net logging
options =>
{
options.IocManager.IocContainer.AddFacility<LoggingFacility>(f => f.UseAbpLog4Net().WithConfig("log4net.config"));
}
);
} public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseAbp(options => { options.UseAbpRequestLocalization = false;}); // Initializes ABP framework. app.UseCors(_defaultCorsPolicyName); // Enable CORS! app.UseStaticFiles(); app.UseAuthentication(); app.UseAbpRequestLocalization(); app.UseSignalR(routes =>
{
routes.MapHub<AbpCommonHub>("/signalr");
}); app.UseMvc(routes =>
{
routes.MapRoute(
name: "defaultWithArea",
template: "{area}/{controller=Home}/{action=Index}/{id?}"); routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
}); // Enable middleware to serve generated Swagger as a JSON endpoint
app.UseSwagger();
// Enable middleware to serve swagger-ui assets (HTML, JS, CSS etc.)
app.UseSwaggerUI(options =>
{
options.SwaggerEndpoint(_appConfiguration["App:ServerRootAddress"] + "/swagger/v1/swagger.json", "Attendance API V1");
options.IndexStream = () => Assembly.GetExecutingAssembly()
.GetManifestResourceStream("Ousu.DataCollection.Attendance.Web.Host.wwwroot.swagger.ui.index.html");
}); // URL: /swagger
}
}
}

去除abp框架自带的命名规则

14,不使用abp框架自带的返回格式

在类或者方法上加上[DontWrapResult]特性

学习ABP遇到的问题汇总的更多相关文章

  1. ABP入门系列(1)——学习Abp框架之实操演练

    作为.Net工地搬砖长工一名,一直致力于挖坑(Bug)填坑(Debug),但技术却不见长进.也曾热情于新技术的学习,憧憬过成为技术大拿.从前端到后端,从bootstrap到javascript,从py ...

  2. 学习ABP ASP.NET Core with Angular 环境问题

    1. 前言 最近学习ABP架构 搭建ASP.NET Core with Angular遇到了些问题,折腾了一个礼拜最终在今天解决了,想想这个过程的痛苦就想利用博客记录下来.其实一直想写博客,但因为 时 ...

  3. ABP入门系列目录——学习Abp框架之实操演练

    ABP是"ASP.NET Boilerplate Project (ASP.NET样板项目)"的简称. ASP.NET Boilerplate是一个用最佳实践和流行技术开发现代WE ...

  4. 2019 年起如何开始学习 ABP 框架系列文章-开篇有益

    2019 年起如何开始学习 ABP 框架系列文章-开篇有益 [[TOC]] 本系列文章推荐阅读地址为:52ABP 开发文档 https://www.52abp.com/Wiki/52abp/lates ...

  5. 学习abp vnext框架到精简到我的Vop框架

    学习目标 框架特点 基于.NET 5平台开发 模块化系统 极少依赖 极易扩展 ....... 框架目的 学习.NET 5平台 学习abp vnext 上图大部分功能已经实现,多数是参考(copy)ab ...

  6. 关于OpenStack的学习路线及相关资源汇总

    首先我们想学习openstack,那么openstack是什么?能干什么?涉及的初衷是什么?由什么来组成?刚接触openstack,说openstack不是一个软件,而是由多个组件进行组合,这是一个更 ...

  7. python学习两月总结_汇总大牛们的思想_值得收藏

    下面是我汇总的我学习两个月python(version:3.3.2)的所有笔记 你可以访问:http://www.python.org获取更多信息 你也可以访问:http://www.cnblogs. ...

  8. django学习-15.ORM查询方法汇总

    1.前言 django的ORM框架提供的查询数据库表数据的方法很多,不同的方法返回的结果也不太一样,不同方法都有各自对应的使用场景. 主要常用的查询方法个数是13个,按照特点分为这4类: 方法返回值是 ...

  9. 一步一步学习ABP项目系列文章目录

    1.概述 基于DDD的.NET开发框架 - ABP初探 基于DDD的.NET开发框架 - ABP分层设计 基于DDD的.NET开发框架 - ABP模块设计 基于DDD的.NET开发框架 - ABP启动 ...

随机推荐

  1. sort与qsort的区别与联系

    sort属于C++范畴,在algorithm头文件中,下面直奔主题,给大家一个清晰明了的认识.qsort有C,和C++两个版本. qsort的compare函数原型 //comp ,也就说,如果the ...

  2. 「Django」contenttypes基本用法

    当一张表和多个表ForeignKey关联,并且多个FK中只能选择其中一个或其中n个时,可以利用contenttypes,只需定义三个字段就搞定! contenttypes 是Django内置的一个应用 ...

  3. Java基础-数据类型应用案例展示

    Java基础-数据类型应用案例展示 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.把long数据转换成字节数组,把字节数组数据转换成long. /* @author :yinz ...

  4. 初识python面向对象编程

    初识python面向对象编程 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.面向过程的程序设计思想 #!/usr/bin/env python #_*_coding:utf-8 ...

  5. 转 -----那些年总也记不牢的IO

    关于资源关闭: 一般情况下是:先打开的后关闭,后打开的先关闭 另一种情况:看依赖关系,如果流a依赖流b,应该先关闭流a,再关闭流b 例如处理流a依赖节点流b,应该先关闭处理流a,再关闭节点流b 当然完 ...

  6. History of Monte Carlo Methods - Part 1

    History of Monte Carlo Methods - Part 1 Some time ago in June 2013 I gave a lab tutorial on Monte Ca ...

  7. javascript多种继承方式(函数式,浅复制,深复制,函数绑定和借用)

    函数式继承: var object = function (obj) { if (typeof Object.create !== 'undefined') { return Object.creat ...

  8. 这两天自己模仿写的一个Asp.Net的显示分页方法 附加实体转换和存储过程

    之前自己一直用Aspnetpager控件来显示项目中的分页,但是每次都要拖一个aspnetpager的控件进去,感觉很不舒服,因为现在自己写的webform都不用服务器控件了,所以自己仿照aspnet ...

  9. LCA 算法(一)ST表

    介绍一种解决最近公共祖先的在线算法,st表,它是建立在线性中的rmq问题之上.   代码:   //LCA: DFS+ST(RMQ) #include<cstdio> #include&l ...

  10. ocky勒索软件恶意样本分析1

    locky勒索软件恶意样本分析1 1 locky勒索软件构成概述 前些时期爆发的Locky勒索软件病毒这边也拿到了一个样本,简要做如下分析.样本主要包含三个程序: A xx.js文件:Jscript脚 ...