Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net core 无法解析类型为';Microsoft.AspNetCore.Cors.Infrastructure.ICorsService_Asp.net Core_F# - Fatal编程技术网

Asp.net core 无法解析类型为';Microsoft.AspNetCore.Cors.Infrastructure.ICorsService

Asp.net core 无法解析类型为';Microsoft.AspNetCore.Cors.Infrastructure.ICorsService,asp.net-core,f#,Asp.net Core,F#,我观察到执行以下代码时出现异常: [<EntryPoint>] let main argv = WebHostBuilder() .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .Configure(Action<IApplicationB

我观察到执行以下代码时出现异常:

[<EntryPoint>]
let main argv =                         
    WebHostBuilder()
        .UseKestrel()
        .UseContentRoot(Directory.GetCurrentDirectory())
        .UseIISIntegration()
        .Configure(Action<IApplicationBuilder> configureApp)
        .ConfigureServices(Action<IServiceCollection> configureServices)
        .Build()
注:

在我添加了ASP.NETWebAPI对一些json的支持之前,这些都是可以使用的

此外,我还将Nuget软件包升级到2.0


源代码可以在上找到。

您必须在
ConfigureServices(IServiceCollection services)中添加
services.AddCors()
我可能已关闭,但我看不到您在
Startup.fs
中使用
AddMvc
UseMvc>的位置,该服务以前运行时没有您建议的行。您具体添加了什么“直到我添加ASP.NET WebAPI支持…”?WebAPI不存在于ASP.NET Core上,正如您所知。Microsoft.AspNet.WebAPI.Client Microsoft.AspNetCore.Mvc.WebApiCompatShim
let configureServices (services : IServiceCollection) =
    ...
    services.AddAuthentication() |> ignore
    services.AddCors |> ignore // Enables CORS