Skip to content

Commit a9e3c6a

Browse files
committed
Fix some errors
1 parent f2b8c67 commit a9e3c6a

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/Servers/IIS/IIS/test/testassets/InProcessWebSite/Startup.WebSockets.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private void WebSocketEcho(IApplicationBuilder app)
6262
{
6363
var ws = await Upgrade(context);
6464
#if FORWARDCOMPAT
65-
var appLifetime = app.ApplicationServices.GetRequiredService<Microsoft.AspNetCore.Hosting.IApplicationLifetime>();
65+
var appLifetime = app.ApplicationServices.GetRequiredService<IHostApplicationLifetime>();
6666
#else
6767
var appLifetime = app.ApplicationServices.GetRequiredService<IHostApplicationLifetime>();
6868
#endif

src/Servers/IIS/IIS/test/testassets/InProcessWebSite/Startup.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ public void ConfigureServices(IServiceCollection serviceCollection)
5555
serviceCollection.AddHttpContextAccessor();
5656
}
5757
#if FORWARDCOMPAT
58-
private async Task ContentRootPath(HttpContext ctx) => await ctx.Response.WriteAsync(ctx.RequestServices.GetService<Microsoft.AspNetCore.Hosting.IHostingEnvironment>().ContentRootPath);
58+
private async Task ContentRootPath(HttpContext ctx) => await ctx.Response.WriteAsync(ctx.RequestServices.GetService<IWebHostEnvironment>().ContentRootPath);
5959

60-
private async Task WebRootPath(HttpContext ctx) => await ctx.Response.WriteAsync(ctx.RequestServices.GetService<Microsoft.AspNetCore.Hosting.IHostingEnvironment>().WebRootPath);
60+
private async Task WebRootPath(HttpContext ctx) => await ctx.Response.WriteAsync(ctx.RequestServices.GetService<IWebHostEnvironment>().WebRootPath);
6161
#else
6262
private async Task ContentRootPath(HttpContext ctx) => await ctx.Response.WriteAsync(ctx.RequestServices.GetService<IWebHostEnvironment>().ContentRootPath);
6363

@@ -175,7 +175,7 @@ public async Task WaitingRequestCount(HttpContext context)
175175
public Task CreateFile(HttpContext context)
176176
{
177177
#if FORWARDCOMPAT
178-
var hostingEnv = context.RequestServices.GetService<Microsoft.AspNetCore.Hosting.IHostingEnvironment>();
178+
var hostingEnv = context.RequestServices.GetService<IWebHostEnvironment>();
179179
#else
180180
var hostingEnv = context.RequestServices.GetService<IWebHostEnvironment>();
181181
#endif
@@ -597,7 +597,7 @@ private async Task WaitForAppToStartShuttingDown(HttpContext ctx)
597597
{
598598
await ctx.Response.WriteAsync("test1");
599599
#if FORWARDCOMPAT
600-
var lifetime = ctx.RequestServices.GetService<Microsoft.AspNetCore.Hosting.IApplicationLifetime>();
600+
var lifetime = ctx.RequestServices.GetService<IHostApplicationLifetime>();
601601
#else
602602
var lifetime = ctx.RequestServices.GetService<IHostApplicationLifetime>();
603603
#endif
@@ -680,8 +680,9 @@ private async Task ReadAndWriteEchoLines(HttpContext ctx)
680680
private async Task ReadAndWriteEchoLinesNoBuffering(HttpContext ctx)
681681
{
682682
#if FORWARDCOMPAT
683-
var feature = ctx.Features.Get<IHttpBufferingFeature>();
684-
feature.DisableResponseBuffering();
683+
var feature = ctx.Features.Get<IHttpResponseBodyFeature>();
684+
feature.DisableBuffering();
685+
Assert.True(ctx.Request.CanHaveBody());
685686
#else
686687
var feature = ctx.Features.Get<IHttpResponseBodyFeature>();
687688
feature.DisableBuffering();
@@ -993,7 +994,7 @@ private async Task Shutdown(HttpContext ctx)
993994
{
994995
await ctx.Response.WriteAsync("Shutting down");
995996
#if FORWARDCOMPAT
996-
ctx.RequestServices.GetService<Microsoft.AspNetCore.Hosting.IApplicationLifetime>().StopApplication();
997+
ctx.RequestServices.GetService<IHostApplicationLifetime>().StopApplication();
997998
#else
998999
ctx.RequestServices.GetService<IHostApplicationLifetime>().StopApplication();
9991000
#endif

0 commit comments

Comments
 (0)