从IHostingEnvironment迁移到IWebHostEnvironment

时间:2019-06-11 01:13:34

标签: f# f#-giraffe

我有这个:

let configureApp (app : IApplicationBuilder) =
    let env = app.ApplicationServices.GetService<IHostingEnvironment>()
    (match env.IsDevelopment() with
    | true  -> app.UseDeveloperExceptionPage()
    | false -> app.UseGiraffeErrorHandler errorHandler)

当我尝试迁移时,出现错误:

let configureApp (app : IApplicationBuilder) =
    let env = app.ApplicationServices.GetService<IWebHostEnvironment>()
    (match env. with

我不知道该代码段应更改什么。

1 个答案:

答案 0 :(得分:1)

基于the documentation,您需要确保已打开命名空间Microsoft.AspNetCore.Hosting