Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/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 我想在扩展方法中使用Endpoints_Asp.net Core_.net Core_Asp.net Core Mvc_Asp.net Mvc Routing - Fatal编程技术网

Asp.net core 我想在扩展方法中使用Endpoints

Asp.net core 我想在扩展方法中使用Endpoints,asp.net-core,.net-core,asp.net-core-mvc,asp.net-mvc-routing,Asp.net Core,.net Core,Asp.net Core Mvc,Asp.net Mvc Routing,我试图在主API项目之外的另一个项目中使用UseEndPoints()扩展方法 但我犯了个错误 IAApplicationBuilder在同一上下文中没有UseEndPoints 我的api startup.cs public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { ... app.UseRouting(); app.UseCors();

我试图在主API项目之外的另一个项目中使用
UseEndPoints()
扩展方法

但我犯了个错误

IAApplicationBuilder在同一上下文中没有UseEndPoints

我的api startup.cs

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
        ...
        app.UseRouting();
        app.UseCors();
        app.UseAuthentication();
        app.UseAuthorization();

        app.UseMapHubs();   // this is my custom middleware
        app.UseEndpoints(endpoints =>
        {
            endpoints.MapControllers();
        });
}
在另一个项目中,我想实现
UseMapHubs()
扩展方法

public static class ExtensionMethods
{
    public static void UseMapHubs(this IApplicationBuilder app)
    {
        app.UseEndpoints(endpoints => // this is the line that fire the error and what I understood from that error that it doesn't find the name space or library for useendpoint 
        {

        });
    }
}

我的问题是:
UseEndPoints
存在于哪个nuget包或库中?

UseEndPoints
存在于
Microsoft.AspNetCore.Builder
中。请参见使用Microsoft.AspNetCore.Builder;仍因缺少库而引发错误