Open netsmallhao opened 4 years ago
macOS High Sierra 10.13.6 system
vs for mac 8.3.4(build 8)
net core 2.2 update 3.0
Clearly some LiteDB incompatibility issues with your platform. Try setting mode=Exclusive
in connection string as advised in the exception message. Or switch to another storage provider proven to work on non-Windows platforms, e.g. Redis or Postgre.
@pieceofsummer Right.
To use Hangfire.LiteDb in macOS and linux it is necessary to use mode = Exclusive in the connection string
Unhandled exception. Autofac.Core.DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = IGlobalConfiguration (DelegateActivator), Services = [Hangfire.IGlobalConfiguration], Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> Your platform does not support FileStream.Lock. Please set mode=Exclusive in your connnection string to avoid this error. (See inner exception for details.) ---> System.InvalidOperationException: Your platform does not support FileStream.Lock. Please set mode=Exclusive in your connnection string to avoid this error. ---> System.PlatformNotSupportedException: Locking/unlocking file regions is not supported on this platform. Use FileShare on the entire file instead. at System.IO.FileStream.LockInternal(Int64 position, Int64 length) at System.IO.FileStream.Lock(Int64 position, Int64 length) at LiteDB.StreamExtensions.<>cDisplayClass4_0.b0()
--- End of inner exception stack trace ---
at LiteDB.StreamExtensions.CreateLockNotSupportedException(PlatformNotSupportedException innerEx)
at LiteDB.StreamExtensions.<>cDisplayClass4_0.b 0()
at LiteDB.FileHelper.TryExec(Action action, TimeSpan timeout)
at LiteDB.StreamExtensions.TryLock(FileStream stream, Int64 position, Int64 length, TimeSpan timeout)
at LiteDB.FileDiskService.Lock(LockState state, TimeSpan timeout)
at LiteDB.LiteEngine..ctor(IDiskService disk, String password, Nullableb4_4(IGlobalConfiguration config) in /Users/xiaohao/我的项目/VACP/源代码/VACP/VACP/Startup.cs:line 142
at Hangfire.HangfireServiceCollectionExtensions.<>c__DisplayClass0_0.b 0(IServiceProvider provider, IGlobalConfiguration config)
at Hangfire.HangfireServiceCollectionExtensions.<>cDisplayClass1_0.b7(IServiceProvider serviceProvider)
at Autofac.Extensions.DependencyInjection.AutofacRegistration.<>cDisplayClass3_0.b 0(IComponentContext context, IEnumerableb0()
at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Funcb 0(IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>cDisplayClass0_0.gMiddlewareFilterBuilder|0(IApplicationBuilder builder)
at Microsoft.AspNetCore.HostFilteringStartupFilter.<>cDisplayClass0_0.b 0(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.WebHost.BuildApplication()
at Microsoft.AspNetCore.Hosting.WebHost.StartAsync(CancellationToken cancellationToken)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String startupMessage)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String startupMessage)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
at VACP.Program.Main(String[] args) in /Users/xiaohao/我的项目/VACP/源代码/VACP/VACP/Program.cs:line 23
1 timeout, Int32 cacheSize, Logger log, Boolean utcDate) at LiteDB.LiteDatabase.<>c__DisplayClass11_0.<.ctor>b__0() at LiteDB.LazyLoad
1.get_Value() at LiteDB.LiteCollection1.EnsureIndex(String field, String expression, Boolean unique) at LiteDB.LiteCollection
1.EnsureIndex(String field, Boolean unique) at Hangfire.LiteDB.HangfireDbContext..ctor(String connectionString, String prefix) at Hangfire.LiteDB.HangfireDbContext.Instance(String connectionString, String prefix) at Hangfire.LiteDB.LiteDbStorage..ctor(String connectionString, LiteDbStorageOptions storageOptions) at Hangfire.LiteDB.LiteDbStorageExtensions.UseLiteDbStorage(IGlobalConfiguration configuration) at VACP.Startup.<>c.1 parameters) 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.<>cDisplayClass5_0.1 creator) at Autofac.Core.Resolving.InstanceLookup.Execute() at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable
1 parameters) at Autofac.Core.Resolving.ResolveOperation.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters) at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable
1 parameters) at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters) at Autofac.Core.Container.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 Hangfire.HangfireServiceCollectionExtensions.ThrowIfNotConfigured(IServiceProvider serviceProvider) at Hangfire.HangfireApplicationBuilderExtensions.UseHangfireDashboard(IApplicationBuilder app, String pathMatch, DashboardOptions options, JobStorage storage) at VACP.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment env) in /Users/xiaohao/我的项目/VACP/源代码/VACP/VACP/Startup.cs:line 177 at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder) at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>cDisplayClass4_0.