You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently I'm using var builder = Host.CreateApplicationBuilder(args); in my initial configuration to work with Workerservice
This is my Appfactory for testing
publicclassWorkerAppFactory:WorkerApplicationFactory<Program>{privateIHosthost;protectedoverridevoidConfigureHost(IHostBuilderbuilder){varconfiguration=TestFixtures.GetContigurationTest(TestFixtures.Settings!);builder.UseEnvironment("Local");builder.ConfigureAppConfiguration((context,config)=>{// Add test configurationconfig.AddConfiguration(configuration);});builder.ConfigureServices(services =>{services.AddTestMongoDb();});}
Bu when I exceuted using StarAsync I get the following Error:
System.AggregateException : One or more errors occurred. (Method 'CreateHostBuilder' was not found in class 'Program' (Assembly: TripArc.Excursion.Api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null))
---- System.Exception : Method 'CreateHostBuilder' was not found in class 'Program' (Assembly: TripArc.Excursion.Api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null)
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at TripArc.Excursion.Api.Unit.Tests.BackgroundServiceTest.UpdateMetatronDescriptionWorkerTest..ctor(WorkerAppFactory workerFactory) in C:\Users\AndrésGustavoMUÑOZ\Projects\Trip-Arc\DMX\TripArc.Excursions.Api\TripArc.Excursion.Api.Unit.Tests\BackgroundServiceTest\UpdateMetatronDescriptionWorkerTest.cs:line 34
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span1 copyOfArgs, BindingFlags invokeAttr) ----- Inner Stack Trace ----- at WorkerService.Testing.HostFactoryResolver.ResolveFactory[T](Assembly assembly, String name) at WorkerService.Testing.HostFactoryResolver.ResolveHostBuilderFactory(Assembly assembly) at WorkerService.Testing.WorkerApplicationFactory1.CreateHostBuilder()
How can I use with
var builder = Host.CreateApplicationBuilder(args); ?
The text was updated successfully, but these errors were encountered:
The WorkerApplicationFactory, similar to the older WebApplicationFactory, expects your entry point class to have a CreateHostBuilder method by convention. So, your Program.cs should look similar to this:
Hi.
Currently I'm using var builder = Host.CreateApplicationBuilder(args); in my initial configuration to work with Workerservice
This is my Appfactory for testing
Bu when I exceuted using StarAsync I get the following Error:
How can I use with
var builder = Host.CreateApplicationBuilder(args); ?
The text was updated successfully, but these errors were encountered: