我有一个全新的.NET-Core Web API项目,我想使用API版本控制和调整。
当我尝试查看摇摇欲坠的页面时,我得到404。但是,模板随附的默认ValuesController有效。
这是我的设置:
启动文件
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
// Add API Versioning
services.AddApiVersioning(
options =>
{
options.DefaultApiVersion = new ApiVersion(1, 0);
options.AssumeDefaultVersionWhenUnspecified = true;
options.ReportApiVersions = true;
});
// Add Swagger
string pathToDoc = "RegistriesApi.xml";
services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1",
new Info
{
Title = "Registries API",
Version = "v1",
Description = "A simple api to interact with AMA registries information",
TermsOfService = "None"
});
string filePath = Path.Combine(PlatformServices.Default.Application.ApplicationBasePath, pathToDoc);
options.IncludeXmlComments(filePath);
options.DescribeAllEnumsAsStrings();
});
}
...
public void …Run Code Online (Sandbox Code Playgroud) 我试图简单地调用我训练的模型的REST API端点,我遇到了问题.我一直称为端点并获得404.
有人知道如何设置此端点的基本教程吗?我只想在Postman中运行它并测试它的工作原理我可以继续我的项目.
任何帮助,将不胜感激!提前致谢!