API发回404

API发回404,api,swagger,visual-studio-2019,.net-core-3.1,swashbuckle.aspnetcore,Api,Swagger,Visual Studio 2019,.net Core 3.1,Swashbuckle.aspnetcore,我正在创建我的第一个API,我知道我遗漏了一些东西。每当我从PL层项目发送请求时,我都会收到一个404错误,当我从Postman发送请求时,我会收到一个“无法验证第一个证书”错误 这是我的主要方法。在启动和启动连接时,所有这些都可以正常工作,但是没有任何东西可以与之通信 public class Program { public static void Main(string[] args) { CreateHostBuilder(

我正在创建我的第一个API,我知道我遗漏了一些东西。每当我从PL层项目发送请求时,我都会收到一个404错误,当我从Postman发送请求时,我会收到一个“无法验证第一个证书”错误

这是我的主要方法。在启动和启动连接时,所有这些都可以正常工作,但是没有任何东西可以与之通信

public class Program
    {
        public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();

        }
        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
            .ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder.UseContentRoot(Directory.GetCurrentDirectory());
                webBuilder.UseIISIntegration();
                webBuilder.UseStartup<Startup>();

            });   
    }
最后,这里是我的jQuery内部的DocumentReady函数方法。api根uri正在从webconfig中提取,但这就是我得到的。EventsGet位于API控制器文件夹的Events文件夹中的EventsController中

    $.ajax({
        url: "http://localhost:44395/api/Event/EventsGet",
        type: 'GET',
        success: function (data) {
            alert('success');
        },
        error: function () {
            alert('error');
        }
    });
当我使用IIS运行API时,它会加载https://localhost:44395/api/values 并尝试打开一个只显示“找不到localhost网页”的网页

我最大的问题是,我不知道从哪里开始,因为一切都很好,但没有任何东西能说明问题。我在谷歌上搜索了一些东西,但要么找不到明确回答我问题的东西,要么我对答案理解不够,无法解决问题

同样在《邮递员》中,我尝试关闭SSL,但也产生了同样的错误。我通读了Swagger文档,并得到了它的所有建议。我知道我遗漏了一些东西,但我不确定要查找什么或如何处理API错误

     [HttpGet]
      public IActionResult EventsGet()
     {
         return Ok();
     }
    $.ajax({
        url: "http://localhost:44395/api/Event/EventsGet",
        type: 'GET',
        success: function (data) {
            alert('success');
        },
        error: function () {
            alert('error');
        }
    });