最近项目升级,从原来的2.0升级到2.1,用的abp框架也做了升级,导致各种bug,原来做的聊天机器人出了问题,原来的EF出了问题,原来的。。。 哎,好吧,记录下~~~
1、2.1之后的系统EF 问题,不支持数据库的var totalGotWeight = await query.SumAsync(entity => (decimal?)entity.TotalWeight); 操作,因此需要把所有的空去掉,参考链接见:https://github.com/aspnet/EntityFrameworkCore/issues/12308
人家说要留到下一个版本去处理,呃呃呃呃,对了,还多了两张表,,这个自己看吧
2、对httpclient做了处理,因为系统访问需要翻墙,本地debug时,一直拿不到tele的数据,报错信息如下:
System.Net.Http.HttpRequestException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
我各种google,就是找不到解决办法,差点改用restclient,哎,那个倒是支持配置代理,参考链接见https://stackoverflow.com/questions/50749042/httpclient-with-net-core-2-1-hangs
最后找到了解决办法,添加handler:(https://gist.github.com/bryanbarnard/8102915),这个127.0.0.1是因为我本地开了代理,全局模式
上一小段代码:
HttpClientHandler handler = new HttpClientHandler()
{
Proxy = new WebProxy("127.0.0.1:1080"),
UseProxy = true,
};
using (var client = new HttpClient(handler))
{
try
{
string url = request.ParseUrl(_botUrl, _token);
Console.WriteLine(url);
HttpResponseMessage response = await client.GetAsync(url);
var statusCode = response.StatusCode;
if (statusCode == HttpStatusCode.OK)
{
var respContent = await
response.Content.ReadAsStringAsync();
return respContent;
}
else
{
return TelegramDefault.RequestError;
}
}
catch (Exception e)
{
Logger.Error(e.Message + "at BaseServer method", e);
return TelegramDefault.RequestError;
}
}
问题3,新的Abp框架不支持多语言处理
问题4,新的Abp框架不支持导出epp插件,,,啊啊啊啊,各种问题,继续加班,先不写啦