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. First non-repeating character in a stream

    First non-repeating character in a stream Given an input stream of n characters consisting only of s ...

  2. 鸟哥的Linux私房菜——第十九章:例行命令的建立

    视频链接:http://www.bilibili.com/video/av11008859/ 1. 什么是例行性命令 (分为两种,一种是周期性的,一种是突发性的)1.1 Linux 工作排程的种类: ...

  3. JDBC编程示例

    package com.lovo.test; import java.sql.Connection;import java.sql.DriverManager;import java.sql.SQLE ...

  4. python---django中form组件(2)自定制属性以及表单的各种验证,以及数据源的实时更新,以及和数据库关联使用ModelForm和元类

    自定义属性以及各种验证 分析widget: class TestForm(forms.Form): user = fields.CharField( required = True, widget = ...

  5. bzoj千题计划179:bzoj1237: [SCOI2008]配对

    http://www.lydsy.com/JudgeOnline/problem.php?id=1237 如果没有相同的数不能配对的限制 那就是排好序后 Σ abs(ai-bi) 相同的数不能配对 交 ...

  6. CString 与其它数据类型转换问题

    CString 头文件#include <afx.h> string 头文件#include <string.h> CString 转char * CString cstr; ...

  7. 【webService客户端】webservice客户端工具

    public static Object invokeWebService(String namespaces,String url, String method, Object[] params, ...

  8. perl6 HTTP::UserAgent (2)

    http://www.cnblogs.com/perl6/p/6911166.html 之前这里有个小小例子, 这里只要是总结一下. HTTP::UserAgent包含了以下模块: --------- ...

  9. 【并行计算】用MPI进行分布式内存编程(一)

    通过上一篇关于并行计算准备部分的介绍,我们知道MPI(Message-Passing-Interface 消息传递接口)实现并行是进程级别的,通过通信在进程之间进行消息传递.MPI并不是一种新的开发语 ...

  10. 分析占用了大量CPU处理时间的是Java进程中哪个线程

    下面是详细步骤: 1. 首先确定进程的 ID ,可以使用 jps -v 或者 top 命令直接查看 2. 查看该进程中哪个线程占用大量 CPU,执行 top -H -p [PID] 结果如下: 可以发 ...