【问题标题】:My Tus URL for .Net Core 3.1 is not working, is my configuration correct?我的 .Net Core 3.1 的 Tus URL 不起作用,我的配置是否正确?
【发布时间】: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


    【解决方案1】:

    看来您无法通过 Postman 提出此类请求。当我下拉并在那里使用 js 客户端库时,我能够让它工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-25
      • 2020-08-22
      • 1970-01-01
      • 2013-04-05
      • 2021-10-22
      • 2020-11-24
      相关资源
      最近更新 更多