Dela via


HTTP: Kestrel- och IIS BadHttpRequestException-typer markerade föråldrade och ersatta

Microsoft.AspNetCore.Server.Kestrel.BadHttpRequestException och Microsoft.AspNetCore.Server.IIS.BadHttpRequestException har markerats föråldrade och ändrats för att härleda från Microsoft.AspNetCore.Http.BadHttpRequestException. Kestrel- och IIS-servrarna genererar fortfarande sina gamla undantagstyper för bakåtkompatibilitet. De föråldrade typerna tas bort i en framtida version.

Mer information finns i dotnet/aspnetcore#20614.

Version introducerad

5.0 Förhandsversion 4

Gammalt beteende

Microsoft.AspNetCore.Server.Kestrel.BadHttpRequestException och Microsoft.AspNetCore.Server.IIS.BadHttpRequestException härleds från System.IO.IOException.

Nytt beteende

Microsoft.AspNetCore.Server.Kestrel.BadHttpRequestException och Microsoft.AspNetCore.Server.IIS.BadHttpRequestException är föråldrade. Typerna härleds också från Microsoft.AspNetCore.Http.BadHttpRequestException, som härleds från System.IO.IOException.

Orsak till ändringen

Ändringen gjordes för att:

  • Konsolidera dubbletttyper.
  • Förena beteende mellan serverimplementeringar.

En app kan nu fånga basfelet Microsoft.AspNetCore.Http.BadHttpRequestException när du använder antingen Kestrel eller IIS.

Ersätt användning av Microsoft.AspNetCore.Server.Kestrel.BadHttpRequestException och Microsoft.AspNetCore.Server.IIS.BadHttpRequestException med Microsoft.AspNetCore.Http.BadHttpRequestException.

Berörda API:er