Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when paired with Microsoft.AspNetCore.Mvc.Versioning #134

Open
rheone opened this issue May 11, 2018 · 0 comments
Open

Issue when paired with Microsoft.AspNetCore.Mvc.Versioning #134

rheone opened this issue May 11, 2018 · 0 comments

Comments

@rheone
Copy link

rheone commented May 11, 2018

When pairing StackExchange.Exceptional.AspNetCore 2.0.0-rc2.* with Microsoft.AspNetCore.Mvc.Versioning 2.2.0 and configuring versioning to ReportApiVersions will throw System.InvalidOperationException: Headers are read-only, response has already started when attempting, and failing, to access the the exceptional page / task.

I'm not sure if this is directly an issue with Exceptional, or with how Microsoft.AspNetCore.Mvc.Versioning is handling headers.

here is my configuration:

public class Startup
{
   // ... other unimportant configuration
   public IServiceProvider ConfigureServices(IServiceCollection services)
   {
         // ... other service configuration
         services.AddExceptional(configuration.GetSection("Exceptional"));
         // ... configure MVC
         services.AddApiVersioning(options =>
                             {
                                options.AssumeDefaultVersionWhenUnspecified = true;
                                options.ReportApiVersions = true;   // when set to true reporting api versions conflicts with StackExchange.Exceptional
                                options.DefaultApiVersion = new ApiVersion(1, 0);
                                options.ApiVersionReader = new HeaderApiVersionReader("api-version");
                             });
         // ... other service configuration
   }                             
}

setting ReportApiVersions to true will

... When this property is set to true, the HTTP headers "api-supported-versions" and "api-deprecated-versions" will be added to all valid service routes...

e.g. response header are modified, and Exceptional begins to fail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant