【发布时间】:2020-12-08 02:33:23
【问题描述】:
当我向 Startup 类中指定的 URL 路径发送请求时,我在使用 Post 请求时收到 404 未找到,我正在使用 Postman。当我使用 Postman 发送选项请求时,我点击了 Startup 类中的代码块并得到 204 No Content。
我在这里做错了什么?我已经去了 tus 的 .NET 示例并通过 chrome 开发工具查看他们的网络请求,我的请求似乎是相同的?!我正在使用.NET core 3.1。
启动类,配置方法。
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseCors(builder => builder
.AllowAnyHeader()
.AllowAnyMethod()
.AllowAnyOrigin()
.WithExposedHeaders(tusdotnet.Helpers.CorsHelper.GetExposedHeaders())
);
app.UseTus(httpContext => new DefaultTusConfiguration
{
// c:\tusfiles is where to store files
Store = new TusDiskStore(@"C:\tusfiles\"),
// On what url should we listen for uploads?
UrlPath = "/files",
Events = new Events
{
OnFileCompleteAsync = async eventContext =>
{
ITusFile file = await eventContext.GetFileAsync();
Console.WriteLine(file);
}
}
});
}
【问题讨论】:
标签: .net asp.net-core tus