gpt4 book ai didi

c# - 乌鸦.Client.Exceptions.Database.DatabaseDoesNotExistException : 'Database ' *****' does not exist

转载 作者:行者123 更新时间:2023-12-05 03:26:22 26 4
gpt4 key购买 nike

我正在使用 RavenTestDriver 进行 .net 核心单元测试。这是我在单元测试解决方案中对 RavenTestDriver 的配置:

public class TestHostBuilder : RavenTestDriver, IAsyncLifetime
{


public async Task InitializeAsync()
{

ConfigureServer(new TestServerOptions
{

CommandLineArgs = new System.Collections.Generic.List<string> { "--RunInMemory=true", },
FrameworkVersion = null,
});

var hostBuilder = easy.api.Program.CreateHostBuilder(new string[0])
.ConfigureWebHost(webHostBuilder =>
{
webHostBuilder.UseTestServer();
})
.ConfigureServices(services =>
{
services.AddScoped<ICurrentUserService, InitRequest>();
services.AddRavenDbAsyncSession(GetDocumentStore());
services.AddScoped<IAsyncDocumentSession>((c) =>
{
return GetDocumentStore().OpenAsyncSession(new SessionOptions()
{
Database="test-server"
});
});
});

var host = hostBuilder.Start();
}

}

但是当我调用我的存储库来获取对象时,我得到了这个错误:

Database 'test-server' does not exist.'
at Raven.Client.Exceptions.Database.DatabaseDoesNotExistException.Throw(String databaseName) in C:\Builds\RavenDB-Stable-5.3\53009\src\Raven.Client\Exceptions\Database\DatabaseDoesNotExistException.cs:line 35
at Raven.Client.Http.RequestExecutor.<ExecuteAsync>d__114`1.MoveNext() in C:\Builds\RavenDB-Stable-5.3\53009\src\Raven.Client\Http\RequestExecutor.cs:line 883
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Raven.Client.Http.RequestExecutor.<ExecuteAsync>d__114`1.MoveNext() in C:\Builds\RavenDB-Stable-5.3\53009\src\Raven.Client\Http\RequestExecutor.cs:line 900
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Raven.Client.Http.RequestExecutor.<UpdateTopologyAsync>d__101.MoveNext() in C:\Builds\RavenDB-Stable-5.3\53009\src\Raven.Client\Http\RequestExecutor.cs:line 455
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at Raven.Client.Http.RequestExecutor.<FirstTopologyUpdate>d__109.MoveNext() in C:\Builds\RavenDB-Stable-5.3\53009\src\Raven.Client\Http\RequestExecutor.cs:line 678
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Raven.Client.Http.RequestExecutor.<WaitForTopologyUpdate>d__107.MoveNext() in C:\Builds\RavenDB-Stable-5.3\53009\src\Raven.Client\Http\RequestExecutor.cs:line 613
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Raven.Client.Http.RequestExecutor.<UnlikelyExecuteAsync>d__106`1.MoveNext() in C:\Builds\RavenDB-Stable-5.3\53009\src\Raven.Client\Http\RequestExecutor.cs:line 583
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Raven.Client.Documents.Session.AsyncDocumentSession.<LoadAsync>d__51`1.MoveNext() in C:\Builds\RavenDB-Stable-5.3\53009\src\Raven.Client\Documents\Session\AsyncDocumentSession.Load.cs:line 30
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at infrastructure.Persistence.RavenDb.RavenRepository`1.<GetByIdAsync>d__6.MoveNext() in D:\gitProjects\Orbis\infrastructure\Persistence\RavenDb\RavenRepository.cs:line 83
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at infrastructure.ApplicationCache.CacheableRepository`1.<GetAsync>d__8.MoveNext() in D:\gitProjects\Orbis\infrastructure\ApplicationCache\CacheableRepository.cs:line 48
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at easy.api.Application.Setting.Queries.GetClientAppSettingQueryHandler.<Handle>d__4.MoveNext() in D:\gitProjects\**\***\Application\Setting\Queries\GetClientAppSettingQuery.cs:line 35
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at api.common.Behaviors.UnhandledExceptionBehaviour`2.<Handle>d__2.MoveNext() in D:\gitProjects\**\api.common\Behaviors\UnhandledExceptionBehaviour.cs:line 22

最佳答案

关于c# - 乌鸦.Client.Exceptions.Database.DatabaseDoesNotExistException : 'Database ' *****' does not exist,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71746610/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com