当我向Startup类中指定的URL路径发送请求时,我得到了404 not found当使用Post请求时,我使用的是Postman。当我使用Postman发送options请求时,我遇到了Startup类中的代码块,并得到了204No Content。
我在这里做错了什么?我已经访问了to的.NET示例,并通过chrome dev工具查看了他们的网络请求,我的请求似乎是相同的?!我正在使用.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);
}
}
});
}

发布于 2020-12-08 02:18:30
因此,您似乎无法通过Postman发出这种类型的请求。当我下拉并使用那里的js client lib时,我能够让它工作。
https://stackoverflow.com/questions/65185702
复制相似问题