Asp.net core 我想在扩展方法中使用Endpoints
我试图在主API项目之外的另一个项目中使用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();
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;仍因缺少库而引发错误