ASP.NET Core Hangfire 配置 Docker?

问题描述 投票:0回答:1

我在向 Docker 发送hangfire时遇到这个错误:

2024-09-01 17:17:34 warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
2024-09-01 17:17:34       Storing keys in a directory '/home/app/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed. For more information go to https://aka.ms/aspnet/dataprotectionwarning
2024-09-01 17:17:34 [14:17:34 WRN] Storing keys in a directory '/home/app/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed. For more information go to https://aka.ms/aspnet/dataprotectionwarning
2024-09-01 17:18:34 [14:18:34 FTL] Host terminated unexpectedly
2024-09-01 17:18:34 System.TimeoutException: A timeout occurred after 30000ms selecting a server using CompositeServerSelector{ Selectors = WritableServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 }, OperationsCountServerSelector }. Client view of cluster state is { ClusterId : "1", Type : "Unknown", State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "Unspecified/localhost:27018" }", EndPoint: "Unspecified/localhost:27018", ReasonChanged: "Heartbeat", State: "Disconnected", ServerVersion: , TopologyVersion: , Type: "Unknown", HeartbeatException: "MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server.
2024-09-01 17:18:34  ---> System.Net.Sockets.SocketException (111): Connection refused [::1]:27018
2024-09-01 17:18:34    at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
2024-09-01 17:18:34    at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
2024-09-01 17:18:34    at MongoDB.Driver.Core.Connections.TcpStreamFactory.Connect(Socket socket, EndPoint endPoint, CancellationToken cancellationToken)
2024-09-01 17:18:34    at MongoDB.Driver.Core.Connections.TcpStreamFactory.CreateStream(EndPoint endPoint, CancellationToken cancellationToken)
2024-09-01 17:18:34    at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelper(CancellationToken cancellationToken)
2024-09-01 17:18:34    --- End of inner exception stack trace ---
2024-09-01 17:18:34    at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelper(CancellationToken cancellationToken)
2024-09-01 17:18:34    at MongoDB.Driver.Core.Connections.BinaryConnection.Open(CancellationToken cancellationToken)
2024-09-01 17:18:34    at MongoDB.Driver.Core.Servers.ServerMonitor.InitializeConnection(CancellationToken cancellationToken)
2024-09-01 17:18:34    at MongoDB.Driver.Core.Servers.ServerMonitor.Heartbeat(CancellationToken cancellationToken)", LastHeartbeatTimestamp: "2024-09-01T14:18:34.2957867Z", LastUpdateTimestamp: "2024-09-01T14:18:34.2957870Z" }] }.
2024-09-01 17:18:34    at MongoDB.Driver.Core.Clusters.Cluster.ThrowTimeoutException(IServerSelector selector, ClusterDescription description)
2024-09-01 17:18:34    at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChanged(IServerSelector selector, ClusterDescription description, Task descriptionChangedTask, TimeSpan timeout, CancellationToken cancellationToken)
2024-09-01 17:18:34    at MongoDB.Driver.Core.Clusters.Cluster.SelectServer(IServerSelector selector, CancellationToken cancellationToken)
2024-09-01 17:18:34    at MongoDB.Driver.Core.Clusters.IClusterExtensions.SelectServerAndPinIfNeeded(ICluster cluster, ICoreSessionHandle session, IServerSelector selector, IReadOnlyCollection`1 deprioritizedServers, CancellationToken cancellationToken)
2024-09-01 17:18:34    at MongoDB.Driver.Core.Bindings.WritableServerBinding.GetWriteChannelSource(IReadOnlyCollection`1 deprioritizedServers, CancellationToken cancellationToken)
2024-09-01 17:18:34    at MongoDB.Driver.Core.Bindings.WritableServerBinding.GetWriteChannelSource(CancellationToken cancellationToken)
2024-09-01 17:18:34    at MongoDB.Driver.Core.Bindings.ReadWriteBindingHandle.GetWriteChannelSource(CancellationToken cancellationToken)
2024-09-01 17:18:34    at MongoDB.Driver.Core.Operations.RetryableWriteContext.Initialize(CancellationToken cancellationToken)
2024-09-01 17:18:34    at MongoDB.Driver.Core.Operations.RetryableWriteContext.Create(IWriteBinding binding, Boolean retryRequested, CancellationToken cancellationToken)
2024-09-01 17:18:34    at MongoDB.Driver.Core.Operations.BulkMixedWriteOperation.Execute(IWriteBinding binding, CancellationToken cancellationToken)
2024-09-01 17:18:34    at MongoDB.Driver.OperationExecutor.ExecuteWriteOperation[TResult](IWriteBinding binding, IWriteOperation`1 operation, CancellationToken cancellationToken)
2024-09-01 17:18:34    at MongoDB.Driver.MongoCollectionImpl`1.ExecuteWriteOperation[TResult](IClientSessionHandle session, IWriteOperation`1 operation, CancellationToken cancellationToken)
2024-09-01 17:18:34    at MongoDB.Driver.MongoCollectionImpl`1.BulkWrite(IClientSessionHandle session, IEnumerable`1 requests, BulkWriteOptions options, CancellationToken cancellationToken)
2024-09-01 17:18:34    at MongoDB.Driver.MongoCollectionImpl`1.<>c__DisplayClass30_0.<BulkWrite>b__0(IClientSessionHandle session)
2024-09-01 17:18:34    at MongoDB.Driver.MongoCollectionImpl`1.UsingImplicitSession[TResult](Func`2 func, CancellationToken cancellationToken)
2024-09-01 17:18:34    at MongoDB.Driver.MongoCollectionImpl`1.BulkWrite(IEnumerable`1 requests, BulkWriteOptions options, CancellationToken cancellationToken)
2024-09-01 17:18:34    at MongoDB.Driver.MongoCollectionBase`1.<>c__DisplayClass41_0.<DeleteOne>b__0(IEnumerable`1 requests, BulkWriteOptions bulkWriteOptions)
2024-09-01 17:18:34    at MongoDB.Driver.MongoCollectionBase`1.DeleteOne(FilterDefinition`1 filter, DeleteOptions options, Func`3 bulkWrite)
2024-09-01 17:18:34    at MongoDB.Driver.MongoCollectionBase`1.DeleteOne(FilterDefinition`1 filter, DeleteOptions options, CancellationToken cancellationToken)
2024-09-01 17:18:34    at MongoDB.Driver.MongoCollectionBase`1.DeleteOne(FilterDefinition`1 filter, CancellationToken cancellationToken)
2024-09-01 17:18:34    at Hangfire.Mongo.Migration.MigrationLock.DeleteMigrationLock()
2024-09-01 17:18:34    at Hangfire.Mongo.Migration.MigrationLock.Dispose()
2024-09-01 17:18:34    at Hangfire.Mongo.MongoStorage..ctor(IMongoClient mongoClient, String databaseName, MongoStorageOptions storageOptions)
2024-09-01 17:18:34    at Hangfire.Mongo.MongoStorage..ctor(MongoClientSettings mongoClientSettings, String databaseName, MongoStorageOptions storageOptions)
2024-09-01 17:18:34    at Hangfire.Mongo.MongoBootstrapperConfigurationExtensions.UseMongoStorage(IGlobalConfiguration configuration, MongoClientSettings mongoClientSettings, String databaseName, MongoStorageOptions storageOptions)
2024-09-01 17:18:34    at Hangfire.Mongo.MongoBootstrapperConfigurationExtensions.UseMongoStorage(IGlobalConfiguration configuration, String connectionString, MongoStorageOptions storageOptions)
2024-09-01 17:18:34    at ara.Jobs.Startup.<>c__DisplayClass8_0.<ConfigureServices>b__1(IGlobalConfiguration configuration) in /src/ara.Jobs/Startup.cs:line 55
2024-09-01 17:18:34    at Hangfire.HangfireServiceCollectionExtensions.<>c__DisplayClass0_0.<AddHangfire>b__0(IServiceProvider provider, IGlobalConfiguration config) in C:\projects\hangfire-525\src\Hangfire.NetCore\HangfireServiceCollectionExtensions.cs:line 40
2024-09-01 17:18:34    at Hangfire.HangfireServiceCollectionExtensions.<>c__DisplayClass1_0.<AddHangfire>b__14(IServiceProvider serviceProvider) in C:\projects\hangfire-525\src\Hangfire.NetCore\HangfireServiceCollectionExtensions.cs:line 103
2024-09-01 17:18:34    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
2024-09-01 17:18:34    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
2024-09-01 17:18:34    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
2024-09-01 17:18:34    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
2024-09-01 17:18:34    at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(ServiceIdentifier serviceIdentifier)
2024-09-01 17:18:34    at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
2024-09-01 17:18:34    at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope)
2024-09-01 17:18:34    at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
2024-09-01 17:18:34    at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
2024-09-01 17:18:34    at Hangfire.HangfireServiceCollectionExtensions.ThrowIfNotConfigured(IServiceProvider serviceProvider) in C:\projects\hangfire-525\src\Hangfire.NetCore\HangfireServiceCollectionExtensions.cs:line 307
2024-09-01 17:18:34    at Hangfire.HangfireServiceCollectionExtensions.CreateBackgroundJobServerHostedService(IServiceProvider provider, JobStorage storage, IEnumerable`1 additionalProcesses, BackgroundJobServerOptions options) in C:\projects\hangfire-525\src\Hangfire.NetCore\HangfireServiceCollectionExtensions.cs:line 241
2024-09-01 17:18:34    at Hangfire.HangfireServiceCollectionExtensions.<>c__DisplayClass9_0.<AddHangfireServerInner>b__0(IServiceProvider provider) in C:\projects\hangfire-525\src\Hangfire.NetCore\HangfireServiceCollectionExtensions.cs:line 194
2024-09-01 17:18:34    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
2024-09-01 17:18:34    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitDisposeCache(ServiceCallSite transientCallSite, RuntimeResolverContext context)
2024-09-01 17:18:34    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
2024-09-01 17:18:34    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite enumerableCallSite, RuntimeResolverContext context)
2024-09-01 17:18:34    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
2024-09-01 17:18:34    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
2024-09-01 17:18:34    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
2024-09-01 17:18:34    at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass2_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
2024-09-01 17:18:34    at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope)
2024-09-01 17:18:34    at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
2024-09-01 17:18:34    at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
2024-09-01 17:18:34    at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
2024-09-01 17:18:34    at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
2024-09-01 17:18:34    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
2024-09-01 17:18:34    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
2024-09-01 17:18:34    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
2024-09-01 17:18:34    at Program.Main(String[] args) in /src/ara.Jobs/Program.cs:line 16

数据库撰写

version: "3.7"

services:

  ara-mongo-db:
    image: mongo:latest
    environment:
      MONGO_INITDB_DATABASE: 'ara'
      MONGO_INITDB_ROOT_USERNAME: '***'
      MONGO_INITDB_ROOT_PASSWORD: '***'
    ports:
      - 27017:27017
    volumes:
      - mongodb_data:/data/db

  arajob-mongo-db:
    image: mongo:latest
    environment:
      MONGO_INITDB_DATABASE: 'arajob'
      MONGO_INITDB_ROOT_USERNAME: '***'
      MONGO_INITDB_ROOT_PASSWORD: '***'
    ports:
      - 27018:27017  
    volumes:
      - arajob_mongodb_data:/data/db


volumes:
  mongodb_data:
  arajob_mongodb_data:

Hangfire Asp.net 核心 Dockerfile

# Base image for the runtime environment
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER app
WORKDIR /app
EXPOSE 5130
EXPOSE 5131

# Image to build the application
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src

# Copy project files
COPY ["./ara.Jobs/ara.Jobs.csproj", "ara.Jobs/"]
COPY ["ara.Application/ara.Application.csproj", "ara.Application/ara.Application/"]
COPY ["ara.Cache/ara.Cache.csproj", "ara.Cache/"]

COPY ["ara.Domain/ara.Domain.csproj", "ara.Domain/"]
COPY ["ara.SharedKernel/ara.SharedKernel.csproj", "ara.SharedKernel/"]
COPY ["ara.Framework/EventsourcingRepository/ara.EventSourcingRepository.csproj", "ara.Framework/EventsourcingRepository/"]
COPY ["ara.Framework/QueryRepository/ara.QueryRepository.csproj", "ara.Framework/QueryRepository/"]
COPY ["ara.Framework/EmailService/ara.EmailService.csproj", "ara.Framework/EmailService/"]
COPY ["ara.Framework/Authentication/ara.Authentication.csproj", "ara.Framework/Authentication/"]
COPY ["ara.ObjectStorage/ara.ObjectStorage.csproj", "ara.ObjectStorage/"]

# Restore, build and publish
RUN dotnet restore "ara.Jobs/ara.Jobs.csproj"
COPY . .
WORKDIR "/src/ara.Jobs"
RUN dotnet build "ara.Jobs.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
RUN dotnet publish "ara.Jobs.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

# Final image
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "ara.Jobs.dll"]

Docker-Compose

version: '3.8'

services:
  ara-jobs:
    build:
      context: .
      dockerfile: Dockerfile
      args:
        BUILD_CONFIGURATION: Release
    ports:
      - "5130:5130"
      - "5131:5131"
    environment:
      - ASPNETCORE_ENVIRONMENT=Development

当我将hangfire发送到docker时,我遇到了这个错误。你能帮助我吗?我该怎么办?

mongodb docker hangfire
1个回答
0
投票

数据库

version: '3.7'
services:
  convert-mysql-db:
    image: mysql:latest
    container_name: convert-mysql-db
    restart: always
    environment:
      MYSQL_DATABASE: convert
      MYSQL_USER: ara
      MYSQL_PASSWORD: ara
      MYSQL_ROOT_PASSWORD: ara
    ports:
      - "3306:3306"
    volumes:
      - mysqldb_data:/var/lib/mysql
    networks:
      - my-network

  convert-mongo-db:
    image: mongo:latest
    container_name: convert-mongo-db
    environment:
      MONGO_INITDB_DATABASE: 'aras'
      MONGO_INITDB_ROOT_USERNAME: 'ara'
      MONGO_INITDB_ROOT_PASSWORD: 'ara'
    ports:
      - "27017:27017"
    volumes:
      - mongodb_data:/data/db
    networks:
      - my-network

  convertjob-mongo-db:
    image: mongo:latest
    container_name: convertjob-mongo-db
    environment:
      MONGO_INITDB_DATABASE: 'convertjob'
      MONGO_INITDB_ROOT_USERNAME: 'ara'
      MONGO_INITDB_ROOT_PASSWORD: 'ara'
    ports:
      - "27018:27017"  # Dış portu 27018, iç portu 27017 olarak ayarladık
    volumes:
      - convertjob_mongodb_data:/data/db
    networks:
      - my-network

  convert-eventstore-db:
    image: eventstore/eventstore:latest
    container_name: convert-eventstore-db
    environment:
      EVENTSTORE_CLUSTER_SIZE: 1
      EVENTSTORE_RUN_PROJECTIONS: All
      EVENTSTORE_START_STANDARD_PROJECTIONS: true
      EVENTSTORE_INT_TCP_PORT: 1112
      EVENTSTORE_HTTP_PORT: 2113
      EVENTSTORE_INSECURE: true
      EVENTSTORE_ENABLE_ATOM_PUB_OVER_HTTP: true
    ports:
      - "1113:1113"
      - "2113:2113"
    volumes:
      - type: volume
        source: eventstore-volume-data
        target: /var/lib/eventstore
      - type: volume
        source: eventstore-volume-logs
        target: /var/log/eventstore
    networks:
      - my-network

  convert-redis-db:
    image: redis:latest
    container_name: convert-redis-db
    command: ["redis-server", "--requirepass", "isbeyconver"]
    environment:
      REDIS_PASSWORD: ara
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data
    networks:
      - my-network
      
networks:
  my-network:
    external: true

volumes:
  mysqldb_data:
  mongodb_data:
  convertjob_mongodb_data:
  eventstore-volume-data:
  eventstore-volume-logs:
  redis_data:

转换工作

version: '3.7'

services:
  convert-jobs:
    build:
      context: .
      dockerfile: Dockerfile
      args:
        BUILD_CONFIGURATION: Release
    container_name: convert-jobs
    ports:
      - "5131:5131"
    networks:
      - my-network

networks:
  my-network:
    external: true

应用程序设置。

"MongoDb": {
  "Url": "convertjob-mongo-db",
  "Port": 27017,
  "Database": "aras",
  "Username": "ara",
  "Password": "ara"
}

 public void ConfigureServices(IServiceCollection services)
 {
     services.AddMediatR(cfg => cfg.RegisterServicesFromAssembly(typeof(DocumentDelete).GetTypeInfo().Assembly));
     services.AddCacheService(Configuration.GetSection("RedisConnection").Get<RedisSettings>());

     // MongoDB ayarlarını yükle
     var mongoDbSettings = Configuration.GetSection("MongoDb").Get<MongoDbSettings>();
     var connectionString = $"mongodb://{mongoDbSettings.Username}:{mongoDbSettings.Password}@{mongoDbSettings.Url}:{mongoDbSettings.Port}/{mongoDbSettings.Database}?authSource=admin";

     var migrationOptions = new MongoMigrationOptions
     {
         BackupStrategy = new CollectionMongoBackupStrategy(),
         MigrationStrategy = new MigrateMongoMigrationStrategy(),
     };

     services.AddHangfire(configuration =>
     {
         configuration.UseMongoStorage(
             connectionString,
             new MongoStorageOptions
             {
                 Prefix = "hangfire.mongo",
                 CheckConnection = false,
                 MigrationOptions = migrationOptions
             });
     });

     // Hangfire Server'ı ekleyin
     services.AddHangfireServer();

     services.Configure<UrlListSettings>(Configuration.GetSection("UrlList"));
 }

错误:

2024-09-02 13:00:55 warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
2024-09-02 13:00:55       Storing keys in a directory '/home/app/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed. For more information go to https://aka.ms/aspnet/dataprotectionwarning
2024-09-02 13:00:55 [10:00:55 WRN] Storing keys in a directory '/home/app/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed. For more information go to https://aka.ms/aspnet/dataprotectionwarning
2024-09-02 13:01:55 [10:01:55 FTL] Host terminated unexpectedly
2024-09-02 13:01:55 System.TimeoutException: A timeout occurred after 30000ms selecting a server using CompositeServerSelector{ Selectors = WritableServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 }, OperationsCountServerSelector }. Client view of cluster state is { ClusterId : "1", Type : "Unknown", State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "Unspecified/localhost:27018" }", EndPoint: "Unspecified/localhost:27018", ReasonChanged: "Heartbeat", State: "Disconnected", ServerVersion: , TopologyVersion: , Type: "Unknown", HeartbeatException: "MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server.
2024-09-02 13:01:55  ---> System.Net.Sockets.SocketException (111): Connection refused [::1]:27018
2024-09-02 13:01:55    at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
2024-09-02 13:01:55    at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
2024-09-02 13:01:55    at MongoDB.Driver.Core.Connections.TcpStreamFactory.Connect(Socket socket, EndPoint endPoint, CancellationToken cancellationToken)
2024-09-02 13:01:55    at MongoDB.Driver.Core.Connections.TcpStreamFactory.CreateStream(EndPoint endPoint, CancellationToken cancellationToken)
2024-09-02 13:01:55    at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelper(CancellationToken cancellationToken)
2024-09-02 13:01:55    --- End of inner exception stack trace ---
2024-09-02 13:01:55    at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelper(CancellationToken cancellationToken)
2024-09-02 13:01:55    at MongoDB.Driver.Core.Connections.BinaryConnection.Open(CancellationToken cancellationToken)
2024-09-02 13:01:55    at MongoDB.Driver.Core.Servers.ServerMonitor.InitializeConnection(CancellationToken cancellationToken)
2024-09-02 13:01:55    at MongoDB.Driver.Core.Servers.ServerMonitor.Heartbeat(CancellationToken cancellationToken)", LastHeartbeatTimestamp: "2024-09-02T10:01:55.8673016Z", LastUpdateTimestamp: "2024-09-02T10:01:55.8673016Z" }] }.
2024-09-02 13:01:55    at MongoDB.Driver.Core.Clusters.Cluster.ThrowTimeoutException(IServerSelector selector, ClusterDescription description)
2024-09-02 13:01:55    at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChanged(IServerSelector selector, ClusterDescription description, Task descriptionChangedTask, TimeSpan timeout, CancellationToken cancellationToken)
2024-09-02 13:01:55    at MongoDB.Driver.Core.Clusters.Cluster.SelectServer(IServerSelector selector, CancellationToken cancellationToken)
2024-09-02 13:01:55    at MongoDB.Driver.Core.Clusters.IClusterExtensions.SelectServerAndPinIfNeeded(ICluster cluster, ICoreSessionHandle session, IServerSelector selector, IReadOnlyCollection`1 deprioritizedServers, CancellationToken cancellationToken)
2024-09-02 13:01:55    at MongoDB.Driver.Core.Bindings.WritableServerBinding.GetWriteChannelSource(IReadOnlyCollection`1 deprioritizedServers, CancellationToken cancellationToken)
2024-09-02 13:01:55    at MongoDB.Driver.Core.Bindings.WritableServerBinding.GetWriteChannelSource(CancellationToken cancellationToken)
2024-09-02 13:01:55    at MongoDB.Driver.Core.Bindings.ReadWriteBindingHandle.GetWriteChannelSource(CancellationToken cancellationToken)
2024-09-02 13:01:55    at MongoDB.Driver.Core.Operations.RetryableWriteContext.Initialize(CancellationToken cancellationToken)
2024-09-02 13:01:55    at MongoDB.Driver.Core.Operations.RetryableWriteContext.Create(IWriteBinding binding, Boolean retryRequested, CancellationToken cancellationToken)
2024-09-02 13:01:55    at MongoDB.Driver.Core.Operations.BulkMixedWriteOperation.Execute(IWriteBinding binding, CancellationToken cancellationToken)
2024-09-02 13:01:55    at MongoDB.Driver.OperationExecutor.ExecuteWriteOperation[TResult](IWriteBinding binding, IWriteOperation`1 operation, CancellationToken cancellationToken)
2024-09-02 13:01:55    at MongoDB.Driver.MongoCollectionImpl`1.ExecuteWriteOperation[TResult](IClientSessionHandle session, IWriteOperation`1 operation, CancellationToken cancellationToken)
2024-09-02 13:01:55    at MongoDB.Driver.MongoCollectionImpl`1.BulkWrite(IClientSessionHandle session, IEnumerable`1 requests, BulkWriteOptions options, CancellationToken cancellationToken)
2024-09-02 13:01:55    at MongoDB.Driver.MongoCollectionImpl`1.<>c__DisplayClass30_0.<BulkWrite>b__0(IClientSessionHandle session)
2024-09-02 13:01:55    at MongoDB.Driver.MongoCollectionImpl`1.UsingImplicitSession[TResult](Func`2 func, CancellationToken cancellationToken)
2024-09-02 13:01:55    at MongoDB.Driver.MongoCollectionImpl`1.BulkWrite(IEnumerable`1 requests, BulkWriteOptions options, CancellationToken cancellationToken)
2024-09-02 13:01:55    at MongoDB.Driver.MongoCollectionBase`1.<>c__DisplayClass41_0.<DeleteOne>b__0(IEnumerable`1 requests, BulkWriteOptions bulkWriteOptions)
2024-09-02 13:01:55    at MongoDB.Driver.MongoCollectionBase`1.DeleteOne(FilterDefinition`1 filter, DeleteOptions options, Func`3 bulkWrite)
2024-09-02 13:01:55    at MongoDB.Driver.MongoCollectionBase`1.DeleteOne(FilterDefinition`1 filter, DeleteOptions options, CancellationToken cancellationToken)
2024-09-02 13:01:55    at MongoDB.Driver.MongoCollectionBase`1.DeleteOne(FilterDefinition`1 filter, CancellationToken cancellationToken)
2024-09-02 13:01:55    at Hangfire.Mongo.Migration.MigrationLock.DeleteMigrationLock()
2024-09-02 13:01:55    at Hangfire.Mongo.Migration.MigrationLock.Dispose()
2024-09-02 13:01:55    at Hangfire.Mongo.MongoStorage..ctor(IMongoClient mongoClient, String databaseName, MongoStorageOptions storageOptions)
2024-09-02 13:01:55    at Hangfire.Mongo.MongoStorage..ctor(MongoClientSettings mongoClientSettings, String databaseName, MongoStorageOptions storageOptions)
2024-09-02 13:01:55    at Hangfire.Mongo.MongoBootstrapperConfigurationExtensions.UseMongoStorage(IGlobalConfiguration configuration, MongoClientSettings mongoClientSettings, String databaseName, MongoStorageOptions storageOptions)
2024-09-02 13:01:55    at Hangfire.Mongo.MongoBootstrapperConfigurationExtensions.UseMongoStorage(IGlobalConfiguration configuration, String connectionString, MongoStorageOptions storageOptions)
2024-09-02 13:01:55    at convert.Jobs.Startup.<>c__DisplayClass8_0.<ConfigureServices>b__1(IGlobalConfiguration configuration) in /src/convert.Jobs/Startup.cs:line 52
2024-09-02 13:01:55    at Hangfire.HangfireServiceCollectionExtensions.<>c__DisplayClass0_0.<AddHangfire>b__0(IServiceProvider provider, IGlobalConfiguration config) in C:\projects\hangfire-525\src\Hangfire.NetCore\HangfireServiceCollectionExtensions.cs:line 40
2024-09-02 13:01:55    at Hangfire.HangfireServiceCollectionExtensions.<>c__DisplayClass1_0.<AddHangfire>b__14(IServiceProvider serviceProvider) in C:\projects\hangfire-525\src\Hangfire.NetCore\HangfireServiceCollectionExtensions.cs:line 103
2024-09-02 13:01:55    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
2024-09-02 13:01:55    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
2024-09-02 13:01:55    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
2024-09-02 13:01:55    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
2024-09-02 13:01:55    at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(ServiceIdentifier serviceIdentifier)
2024-09-02 13:01:55    at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
2024-09-02 13:01:55    at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope)
2024-09-02 13:01:55    at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
2024-09-02 13:01:55    at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
2024-09-02 13:01:55    at Hangfire.HangfireServiceCollectionExtensions.ThrowIfNotConfigured(IServiceProvider serviceProvider) in C:\projects\hangfire-525\src\Hangfire.NetCore\HangfireServiceCollectionExtensions.cs:line 307
2024-09-02 13:01:55    at Hangfire.HangfireServiceCollectionExtensions.CreateBackgroundJobServerHostedService(IServiceProvider provider, JobStorage storage, IEnumerable`1 additionalProcesses, BackgroundJobServerOptions options) in C:\projects\hangfire-525\src\Hangfire.NetCore\HangfireServiceCollectionExtensions.cs:line 241
2024-09-02 13:01:55    at Hangfire.HangfireServiceCollectionExtensions.<>c__DisplayClass9_0.<AddHangfireServerInner>b__0(IServiceProvider provider) in C:\projects\hangfire-525\src\Hangfire.NetCore\HangfireServiceCollectionExtensions.cs:line 194
2024-09-02 13:01:55    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
2024-09-02 13:01:55    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitDisposeCache(ServiceCallSite transientCallSite, RuntimeResolverContext context)
2024-09-02 13:01:55    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
2024-09-02 13:01:55    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite enumerableCallSite, RuntimeResolverContext context)
2024-09-02 13:01:55    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
2024-09-02 13:01:55    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
2024-09-02 13:01:55    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
2024-09-02 13:01:55    at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass2_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
2024-09-02 13:01:55    at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope)
2024-09-02 13:01:55    at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
2024-09-02 13:01:55    at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
2024-09-02 13:01:55    at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
2024-09-02 13:01:55    at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
2024-09-02 13:01:55    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
2024-09-02 13:01:55    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
2024-09-02 13:01:55    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
2024-09-02 13:01:55    at Program.Main(String[] args) in /src/convert.Jobs/Program.cs:line 16

你能帮我解决这里出了什么问题吗?

© www.soinside.com 2019 - 2024. All rights reserved.