1

I have an application generated from a Steeltoe Initialzr, using Steeltoe 3.1.2.

For some reason, when compiling I am getting:

dotnet/Extract/Startup.cs(53,27): error CS1501: No overload for method 'MapAllActuators' takes 0 arguments [dotnet/Extract/Extract.csproj]

Here is my Configure method:

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseSwagger();
                app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Extract"));
            }

            app.UseHttpsRedirection();
            app.UseRouting();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                endpoints.MapAllActuators();
            });
        }

And the project definition:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
    <Nullable>disable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>

  <PropertyGroup>
    <SteeltoeVersion>3.1.2</SteeltoeVersion>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.*" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="OpenTelemetry.Exporter.Jaeger" Version="1.1.0" />
    <PackageReference Include="Steeltoe.Extensions.Logging.DynamicLogger" Version="$(SteeltoeVersion)" />
    <PackageReference Include="Steeltoe.Management.EndpointCore" Version="$(SteeltoeVersion)" />
    <PackageReference Include="Steeltoe.Management.TracingCore" Version="$(SteeltoeVersion)" />
  </ItemGroup>

</Project>

Any idea what the root cause might be ?

1 Answers1

1

There are a number of options for adding actuators:

  1. Using IWebHostBuilder extensions

    .ConfigureWebHostDefaults(webBuilder => { webBuilder.AddAllActuators() .UseStartup(); });

  2. Using IServiceCollection extensions (as the initializr sample does)

    services.AddAllActuators(Configuration);

  3. You can do what you are doing as well, but it requires a convention or forces you to pass null (Created an issue to track this)

    endpoints.MapAllActuators(convention => convention.RequireCors("corspolicy"));

or

endpoints.MapAllActuators(null);

The first two options are recommended, and they also give you the ability to add conventions - see samples here

Hananiel
  • 421
  • 2
  • 9