anjoy8 / blog.core Goto Github PK
View Code? Open in Web Editor NEW💖 ASP.NET Core 8.0 全家桶教程,前后端分离后端接口,vue教程姊妹篇,官方文档:
Home Page: http://apk.neters.club/.doc
License: Apache License 2.0
💖 ASP.NET Core 8.0 全家桶教程,前后端分离后端接口,vue教程姊妹篇,官方文档:
Home Page: http://apk.neters.club/.doc
License: Apache License 2.0
这个问题不好解决,批量插入自增型的数据时,没法绑定自增主键ID。
上sqlsugar查了,人家回答好彻底:不可以。http://www.codeisbug.com/Ask/9/8049
有没有好的折中方案?
bug太多了。,
线上的权限分配勾选父权限。无法选中子的
已经定位到问题所在:
Startup.cs
//记录请求与返回数据
app.UseReuestResponseLog();
如果 注释后运行就不会出现上述问题
` ///
var data = new MessageModel<string>();
if (sysUserInfo != null && sysUserInfo.uID > 0)
{
if (sysUserInfo.RID > 0)
{
var usrerole = await _userRoleServices.Query(d => d.UserId == sysUserInfo.uID && d.RoleId == sysUserInfo.RID);
if (usrerole.Count == 0)
{
await _userRoleServices.Add(new UserRole(sysUserInfo.uID, sysUserInfo.RID));
}
}
data.success = await _sysUserInfoServices.Update(sysUserInfo);
if (data.success)
{
data.msg = "更新成功";
data.response = sysUserInfo?.uID.ObjToString();
}
}
return data;
}`
希望增加sqlsugar的日志功能
Application: dotnet.exe
CoreCLR Version: 4.700.19.46205
.NET Core Version: 3.0.0
Description: The process was terminated due to an unhandled exception.
Exception Info: Autofac.Core.DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = IHostedService[] (DelegateActivator), Services = [System.Collections.Generic.IEnumerable1[[Microsoft.Extensions.Hosting.IHostedService, Microsoft.Extensions.Hosting.Abstractions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]]], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = ExternallyOwned ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = Job1TimedService (ReflectionActivator), Services = [Microsoft.Extensions.Hosting.IHostedService], Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = BlogArticleServices (ReflectionActivator), Services = [Blog.Core.IServices.BASE.IBaseServices
1[[Blog.Core.Model.Models.BlogArticle, Blog.Core.Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Blog.Core.IServices.IBlogArticleServices], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Blog.Core.Services.BlogArticleServices' can be invoked with the available services and parameters:
Cannot resolve parameter 'Blog.Core.IRepository.IBlogArticleRepository dal' of constructor 'Void .ctor(Blog.Core.IRepository.IBlogArticleRepository, AutoMapper.IMapper)'. (See inner exception for details.) (See inner exception for details.) (See inner exception for details.)
---> Autofac.Core.DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = Job1TimedService (ReflectionActivator), Services = [Microsoft.Extensions.Hosting.IHostedService], Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = BlogArticleServices (ReflectionActivator), Services = [Blog.Core.IServices.BASE.IBaseServices1[[Blog.Core.Model.Models.BlogArticle, Blog.Core.Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Blog.Core.IServices.IBlogArticleServices], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Blog.Core.Services.BlogArticleServices' can be invoked with the available services and parameters: Cannot resolve parameter 'Blog.Core.IRepository.IBlogArticleRepository dal' of constructor 'Void .ctor(Blog.Core.IRepository.IBlogArticleRepository, AutoMapper.IMapper)'. (See inner exception for details.) (See inner exception for details.) ---> Autofac.Core.DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = BlogArticleServices (ReflectionActivator), Services = [Blog.Core.IServices.BASE.IBaseServices
1[[Blog.Core.Model.Models.BlogArticle, Blog.Core.Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Blog.Core.IServices.IBlogArticleServices], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Blog.Core.Services.BlogArticleServices' can be invoked with the available services and parameters:
Cannot resolve parameter 'Blog.Core.IRepository.IBlogArticleRepository dal' of constructor 'Void .ctor(Blog.Core.IRepository.IBlogArticleRepository, AutoMapper.IMapper)'. (See inner exception for details.)
---> Autofac.Core.DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Blog.Core.Services.BlogArticleServices' can be invoked with the available services and parameters:
Cannot resolve parameter 'Blog.Core.IRepository.IBlogArticleRepository dal' of constructor 'Void .ctor(Blog.Core.IRepository.IBlogArticleRepository, AutoMapper.IMapper)'.
at Autofac.Core.Activators.Reflection.ReflectionActivator.GetValidConstructorBindings(IComponentContext context, IEnumerable1 parameters) at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable
1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters, Object& decoratorTarget) --- End of inner exception stack trace --- at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable
1 parameters, Object& decoratorTarget)
at Autofac.Core.Resolving.InstanceLookup.<>c__DisplayClass5_0.b__0()
at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func1 creator) at Autofac.Core.Resolving.InstanceLookup.Execute() at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable
1 parameters)
at Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters) at Autofac.Core.Activators.Reflection.AutowiringParameter.<>c__DisplayClass0_0.<CanSupplyValue>b__0() at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable
1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters, Object& decoratorTarget) --- End of inner exception stack trace --- at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable
1 parameters, Object& decoratorTarget)
at Autofac.Core.Resolving.InstanceLookup.<>c__DisplayClass5_0.b__0()
at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func1 creator) at Autofac.Core.Resolving.InstanceLookup.Execute() at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable
1 parameters)
at Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters) at Autofac.Features.Collections.CollectionRegistrationSource.<>c__DisplayClass0_1.<RegistrationsFor>b__2(IComponentRegistration cr) at System.Linq.Enumerable.SelectIPartitionIterator
2.MoveNext()
at System.Linq.Enumerable.OfTypeIterator[TResult](IEnumerable source)+MoveNext()
at System.Collections.Generic.LargeArrayBuilder1.AddRange(IEnumerable
1 items)
at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable
1 source)
at Autofac.Features.Collections.CollectionRegistrationSource.<>c__DisplayClass0_0.b__0(IComponentContext c, IEnumerable1 p) at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable
1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters, Object& decoratorTarget) --- End of inner exception stack trace --- at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable
1 parameters, Object& decoratorTarget)
at Autofac.Core.Resolving.InstanceLookup.Execute()
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters) at Autofac.Core.Resolving.ResolveOperation.ResolveComponent(IComponentRegistration registration, IEnumerable
1 parameters)
at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable1 parameters) at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable
1 parameters)
at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable1 parameters, Object& instance) at Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext context, Service service, IEnumerable
1 parameters)
at Autofac.ResolutionExtensions.ResolveOptional(IComponentContext context, Type serviceType, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.ResolveOptional(IComponentContext context, Type serviceType)
at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
at Blog.Core.Program.Main(String[] args) in D:\Work\Svn\Blog\Blog.Core\Blog.Core\Program.cs:line 64
建议:可以考虑通过配置切换 jwt 和ids ,现在要手动去修改里面4个位置才能切换成jwt,对于一些单个项目的还是不够方便.
这个系统是怎么使用事务的?UseTran
Application: dotnet.exe
CoreCLR Version: 4.700.19.46205
.NET Core Version: 3.0.0
Description: The process was terminated due to an unhandled exception.
Exception Info: Autofac.Core.DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = IHostedService[] (DelegateActivator), Services = [System.Collections.Generic.IEnumerable1[[Microsoft.Extensions.Hosting.IHostedService, Microsoft.Extensions.Hosting.Abstractions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]]], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = ExternallyOwned ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = Job1TimedService (ReflectionActivator), Services = [Microsoft.Extensions.Hosting.IHostedService], Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = BlogArticleServices (ReflectionActivator), Services = [Blog.Core.IServices.BASE.IBaseServices
1[[Blog.Core.Model.Models.BlogArticle, Blog.Core.Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Blog.Core.IServices.IBlogArticleServices], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Blog.Core.Services.BlogArticleServices' can be invoked with the available services and parameters:
Cannot resolve parameter 'Blog.Core.IRepository.IBlogArticleRepository dal' of constructor 'Void .ctor(Blog.Core.IRepository.IBlogArticleRepository, AutoMapper.IMapper)'. (See inner exception for details.) (See inner exception for details.) (See inner exception for details.)
---> Autofac.Core.DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = Job1TimedService (ReflectionActivator), Services = [Microsoft.Extensions.Hosting.IHostedService], Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = BlogArticleServices (ReflectionActivator), Services = [Blog.Core.IServices.BASE.IBaseServices1[[Blog.Core.Model.Models.BlogArticle, Blog.Core.Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Blog.Core.IServices.IBlogArticleServices], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Blog.Core.Services.BlogArticleServices' can be invoked with the available services and parameters: Cannot resolve parameter 'Blog.Core.IRepository.IBlogArticleRepository dal' of constructor 'Void .ctor(Blog.Core.IRepository.IBlogArticleRepository, AutoMapper.IMapper)'. (See inner exception for details.) (See inner exception for details.) ---> Autofac.Core.DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = BlogArticleServices (ReflectionActivator), Services = [Blog.Core.IServices.BASE.IBaseServices
1[[Blog.Core.Model.Models.BlogArticle, Blog.Core.Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Blog.Core.IServices.IBlogArticleServices], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Blog.Core.Services.BlogArticleServices' can be invoked with the available services and parameters:
Cannot resolve parameter 'Blog.Core.IRepository.IBlogArticleRepository dal' of constructor 'Void .ctor(Blog.Core.IRepository.IBlogArticleRepository, AutoMapper.IMapper)'. (See inner exception for details.)
---> Autofac.Core.DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Blog.Core.Services.BlogArticleServices' can be invoked with the available services and parameters:
Cannot resolve parameter 'Blog.Core.IRepository.IBlogArticleRepository dal' of constructor 'Void .ctor(Blog.Core.IRepository.IBlogArticleRepository, AutoMapper.IMapper)'.
at Autofac.Core.Activators.Reflection.ReflectionActivator.GetValidConstructorBindings(IComponentContext context, IEnumerable1 parameters) at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable
1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters, Object& decoratorTarget) --- End of inner exception stack trace --- at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable
1 parameters, Object& decoratorTarget)
at Autofac.Core.Resolving.InstanceLookup.<>c__DisplayClass5_0.b__0()
at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func1 creator) at Autofac.Core.Resolving.InstanceLookup.Execute() at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable
1 parameters)
at Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters) at Autofac.Core.Activators.Reflection.AutowiringParameter.<>c__DisplayClass0_0.<CanSupplyValue>b__0() at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable
1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters, Object& decoratorTarget) --- End of inner exception stack trace --- at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable
1 parameters, Object& decoratorTarget)
at Autofac.Core.Resolving.InstanceLookup.<>c__DisplayClass5_0.b__0()
at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func1 creator) at Autofac.Core.Resolving.InstanceLookup.Execute() at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable
1 parameters)
at Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters) at Autofac.Features.Collections.CollectionRegistrationSource.<>c__DisplayClass0_1.<RegistrationsFor>b__2(IComponentRegistration cr) at System.Linq.Enumerable.SelectIPartitionIterator
2.MoveNext()
at System.Linq.Enumerable.OfTypeIterator[TResult](IEnumerable source)+MoveNext()
at System.Collections.Generic.LargeArrayBuilder1.AddRange(IEnumerable
1 items)
at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable
1 source)
at Autofac.Features.Collections.CollectionRegistrationSource.<>c__DisplayClass0_0.b__0(IComponentContext c, IEnumerable1 p) at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable
1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters, Object& decoratorTarget) --- End of inner exception stack trace --- at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable
1 parameters, Object& decoratorTarget)
at Autofac.Core.Resolving.InstanceLookup.Execute()
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters) at Autofac.Core.Resolving.ResolveOperation.ResolveComponent(IComponentRegistration registration, IEnumerable
1 parameters)
at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable1 parameters) at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable
1 parameters)
at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable1 parameters, Object& instance) at Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext context, Service service, IEnumerable
1 parameters)
at Autofac.ResolutionExtensions.ResolveOptional(IComponentContext context, Type serviceType, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.ResolveOptional(IComponentContext context, Type serviceType)
at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
at Blog.Core.Program.Main(String[] args) in D:\Work\Svn\Blog\Blog.Core\Blog.Core\Program.cs:line 64
There is already an open DataReader associated with this Command which must be closed first.
可以尝试在连接字符串中,加上
MultipleActiveResultSets=true
具体的原因和方案,探究中
运行后报错这个,SqlSugar.SqlSugarException:“MySql.Data.dll Nuget更新到 6.10.4 版本的(Core 2.0只支持当前版本), 再检查连接字符串是否正确,Unable to connect to any of the specified MySQL hosts.”,您好,请问下这个要怎么改下哪里啊,mysql连接字符串已经改过了
起初是在自己的项目里,使用aop事务出现了This SqlTransaction has completed; it is no longer usable.的问题,后发现是在services层调用多个Repository层方法时,可能在services方法未执行完成的情况下,提交了事务。
后下载了博主的源码。也发现了类似的问题。
这里访问第一个数据访问层方法
然后就进了aop,接着断点就开始乱跳
在访问第三个数据访问层方法之前,工作单元就会提交事务(实际上也可能直接跟着图2继续执行下去)
接着就会报This SqlTransaction has completed; it is no longer usable.的问题
但是在我的项目里数据库操作是会成功的,用的是mssql
怀疑是否有可能是拦截器和service层并行了导致的,因为都是异步方法。
感谢群主开源,对.Net社区做的贡献。
如题,调试的时候执行到AwaitTaskWithPostActionAndFinallyAndGetResult 方法的 await postAction();就直接结束了,请问怎么解决
在日常的使用当中,有需求要连接多个数据库来操作。这时候要怎么去处理这个dbcontext呢?
后期有安排这方面的东西吗?
项目改名模板不能正常工作,改名后一些接口丢失!例如:GetTreeTable
一个用户多个角色只能获取搜索到的第一个角色的菜单
///
数据库里没有数据,求SQL
Vschool.FrameWork T4好像不可以切换数据源,只能mssql 我想用mysql
环境:sqlsugar+mysql
[SugarColumn(ColumnName = "approval_time", ColumnDescription = "审核时间"**,IsNullable =true**)] public DateTime approval_time { get; set; }
加上特性IsNullable =true 但是 DateTime 没有加?实体查询的时候会导致程序崩溃!是奔溃!不是报错哦! 如果改成
[SugarColumn(ColumnName = "approval_time", ColumnDescription = "审核时间"**,IsNullable =true**)] public DateTime? approval_time { get; set; }
就没有问题
把自己项目名加到url中了,导致无法下载数据。
dotnet new blogcoretpl生成的项目怎么保证最新?
项目非常好,还有文章配合,学到很多东西,大神!牛逼!🐂🍺!非常感谢。
你好,前端框架是还没有搭建好吗?我在代码库里面没有看到前端项目的代码
【用sqlsugr有时候会报Invalid operation. The connection is closed】
【说明】:就是在异步多并发的时候,sugar实例偶尔会出现连接异常,并不是很常见,如果并发达不到一千以上,不用担心这个问题。
【更正】:有人提到这个问题,多半是自己没有更新SqlSugar 5.0.10+版本,请不要使用之前的版本,还一直压测说报错。
如果还不行
【最后的方案】
1、或者每次访问仓储中每一个方法的时候,都new一个实例,这样实例就不会丢失了。比如把BaseRepository的_db换成一个获取实例方法,每次都new一个,或者ISqlsugarclient注入改成services.AddTransient(o =>。
但是这样不利于事务提交,所以我不建议这么操作。
2、当然好像在同步中没有这个问题,想省事儿,改成同步也行。
MD5Encrypt32
pwd = string.Concat(pwd, item.ToString("X"));
改成
pwd = string.Concat(pwd, item.ToString("X2"));
要保证32位
I am not using Log4 dot net.insted of lo4.net i am using serilog
private static readonly log4net.ILog log =
log4net.LogManager.GetLogger(typeof(ExceptionHandlerMidd));
so please help me How to Configure serilog in Exception middleware
Please help i want to use identity server 4 in seprate project
Please help how to use
System.ArgumentException:“IDX12709: CanReadToken() returned false. JWT is not well formed: '[PII is hidden]'.
The token needs to be in JWS or JWE Compact Serialization Format. (JWS): 'EncodedHeader.EndcodedPayload.EncodedSignature'. (JWE): 'EncodedProtectedHeader.EncodedEncryptedKey.EncodedInitializationVector.EncodedCiphertext.EncodedAuthenticationTag'.”
Blog控制器内的获取博客列表方法的分页写法错误 计算结果少了一页
“Log\” -> 改成 "Log/"
static Appsettings()
{
string Path = "appsettings.json";
if (Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == "Development")
{
Path = "appsettings.Development.json";
}
Configuration = new ConfigurationBuilder()
.Add(new JsonConfigurationSource { Path = Path, ReloadOnChange = true })//请注意要把当前appsetting.json 文件->右键->属性->复制到输出目录->始终复制
.Build();
}
增加环境变量的判断
if (typeof(Task).IsAssignableFrom(type))
{
var resultProperty = type.GetProperty("Result");
dataIntercept += ($"【执行完成结果】:{JsonConvert.SerializeObject(resultProperty.GetValue(invocation.ReturnValue))}");
}
else
{
dataIntercept += ($"【执行完成结果】:{invocation.ReturnValue}");
}
Parallel.For(0, 1, e =>
{
LogLock.OutSql2Log("AOPLog", new string[] { dataIntercept });
});//多线程并行的for循环
方法无法执行到log记录
https://github.com/anjoy8/Blog.Core/blob/netcore2.2/Blog.Core.Model/Seed/DBSeed.cs
该文件下的GitJsonFileFormat和GitJsonFileForma2 url不存在(gitee和github)都如此,导致无法自动初始化表数据。估计是大牛你忘记了url吧。
改为如下。具体大牛你再看下
// 这是我的在线demo数据,比较多,且杂乱
// 国内网络不好的,可以使用这个 gitee 上的地址:https://gitee.com/laozhangIsPhi/Blog.Data.Share/raw/master/BlogCore.Data.json/{0}.tsv
// 形如https://gitee.com/laozhangIsPhi/Blog.Data.Share/raw/master/BlogCore.Data.json/BlogArticle.tsv
// private static string GitJsonFileFormat = "https://gitee.com/laozhangIsPhi/Blog.Data.Share/raw/master/BlogCore.Data.json/{0}.tsv";
private static string GitJsonFileFormat = "https://github.com/anjoy8/Blog.Data.Share/blog/master/BlogCore.Data.json.json/{0}.tsv";
// 这里我把重要的权限数据提出来的精简版,默认一个Admin_Role + 一个管理员用户,
// 然后就是菜单+接口+权限分配,注意没有其他博客信息了,下边seeddata 的时候,删掉即可。
// 国内网络不好的,可以使用这个 gitee 上的地址:https://gitee.com/laozhangIsPhi/Blog.Data.Share/tree/master/Student.Achieve.json/{0}.tsv
private static string GitJsonFileFormat2 = "https://github.com/anjoy8/Blog.Data.Share/blob/master/Student.Achieve.json/{0}.tsv";
XXXRepository通过反射加入容器,那这个 IUnitOfWork 肯定来源于容器依赖注入,IUnitOfWork 依赖于SqlSugarClient的ADO事务;这种传递是为何?也没见类内部使用啊。
如果想用跨方法事务,直接在构造方法注入即可,开启线程share,难道不传时,直接注入IUnitOfWork 会出问题?
错误信息:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT NULL
DbHelper.ttinclude 下载下来的大小为 14k --博主认为是 上传文件有问题 待检查
报错如下:正在编译转换: 类、结构或接口成员声明中的标记“this”无效 Blog.Core.FrameWork
E:\Study\BlogTest\Blog.Core-master (1)\Blog.Core-master\Blog.Core.FrameWork\DbHelper.ttinclude
1,当应用程序部署在iis 中,iis应用程序池有回收机制,回收之后quartz会全部停止,此时TasksQz表里的IsStart 字段将不再准确,
建议使用以下代码判断启动状态
public async Task GetJobState(TaskJobInfo model)
{
JobKey jobKey = new JobKey(model.rowId.ToString(), model.jobGroup);
var triggers = (await _scheduler.Result.GetTriggersOfJob(jobKey)).FirstOrDefault();
if (triggers != null)
{
return await _scheduler.Result.GetTriggerState(triggers.Key);
}
return TriggerState.None;
}
2,建议将task 从主程序中剥离出来,单独部署
楼主发现个错误,如下
测试代码
` public async Task Login([FromBody] LoginModel loginModel)
{
return new JsonResult(new
{
success = false,
message = "msg"
});
}`
在 IPLogMildd.cs 报错 行 72
导致进不到方法中
您好,如果我有一个CommonController通用方法想调用数据库的存储过程这个要写在哪里呢
Castle.DynamicProxy.ProxyGenerationException: This is a DynamicProxy2 error: Target type for the proxy implements Castle.DynamicProxy.IProxyTargetAccessor which is a DynamicProxy infrastructure interface and you should never implement it yourself. Are you trying to proxy an existing proxy?
跟进中
在数据insert或update之后,怎么把相关的Redis缓存清理掉呢
建议可以按照下面来进行处理一下
if (key != "")
{
permissions = permissionsList.Where(a => a.Name.Contains(key)).OrderBy(a => a.OrderSort).ToList();
}
else
{
permissions = permissionsList.Where(a => a.Pid == pid).OrderBy(a => a.OrderSort).ToList();
}
master,NETcore2.2 有什么区别吗,master 是NETCore 2.2吗
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.