首页 \ 问答 \ 用于将上传传递给第三方的ASP.Net架构(ASP.Net architecture for passing upload to third party)

用于将上传传递给第三方的ASP.Net架构(ASP.Net architecture for passing upload to third party)

我正在开发一个专门用于站在YouTube API之上的应用程序,并将用户上传的内容传递到YouTube.Videos.Insert端点(使用他们提供的.NET客户端库)。 现在,我的应用程序是作为一个简单的ASP.NET MVC应用程序构建的,但我很快意识到这可能不是最好的方法,因为问题很快就会发现上传过程可能是一个相当长时间运行的过程。

为了有效地做到这一点,最佳实践架构会是什么? 到目前为止我的想法是:

  • 某种排队策略,MVC应用程序将上传内容放入队列,后台进程将其弹出并执行进一步上传到YouTube。 但这似乎效率低下,因为它会临时存储文件并再次检索它以处理应用程序的总体开销。
  • 一个单独的微服务API,带有一个端点,用于接收实际上传,我将通过我的应用程序前端的Javascript联系; 它将接收该文件,返回202 Accepted,并将上传流传递到异步线程并立即处理。 这似乎更有效但我担心可扩展性,如果除了我以外的任何人最终使用这个东西。

我希望有更多的架构洞察力来解决这个问题的最佳方法。


I'm working on an application which is designed to stand on top of the YouTube API and pass uploads from the user to the YouTube.Videos.Insert endpoint (using the .NET client library they provide). Right now, my application is built as a simple ASP.NET MVC application, but I'm quickly realizing that may not be the best approach, because the issue quickly crops up that the upload process could be a rather long-running one.

What would the best-practice architecture be in order to do this effectively? My ideas thus far are:

  • Some sort of queue strategy, where the MVC app puts the upload on the queue, and a background process pops it off and performs the further upload to YouTube. This seems inefficient, though, since it adds storing the file temporarily and retrieving it again for processing to the overall overhead of the application.
  • A separate microservice API with an endpoint for receiving the actual upload, which I would contact via Javascript from the front-end of my app; it would receive the file, return a 202 Accepted, and pass the upload stream off into an async thread and process it immediately. This seems more efficient but I'm worried about scalability if anyone besides me ends up using this thing.

I would love additional architecture insight on the best way to approach this.


原文:https://stackoverflow.com/questions/46286257
更新时间:2023-04-23 22:04

最满意答案

<nixpkgs>是一个Nix表达式,通过查看NIX_PATH环境变量和/或-I选项中的Nix搜索路径来NIX_PATH

Nix手册中有更详细的描述。

请注意,在许多情况下,Nix搜索路径是不切实际的。 你只能从外面传递它,它很容易产生杂质。 根据我的经验,通过显式参数传递或与诸如callPackage和覆盖系统之类的callPackage相关的函数可以更好地解决问题。

例如,NixOS只有一个额外的搜索路径参数,如果没有给出明确的配置, nixos/default.nixnixos/default.nix读取一次。 这样,您就可以灵活地提供自己的配置,这就是为什么您( nix-build )和hydra可以放心地构建NixOS VM测试,可启动映像,docker镜像等的原因。


<nixpkgs> is a Nix expression that is evaluated by looking at the Nix search path in the NIX_PATH environment variable and/or -I option.

It is described in more detail in the Nix manual.

Note that the Nix search path is impractical in many situations. You can only pass it from the outside, and it easily creates impurity. In my experience, problems are better solved with explicit argument passing or the functions relating to fix-points like callPackage and the overlay system.

As an example, NixOS has only one extra search path parameter, and it is only read once in nixos/default.nix if no explicit configuration is given. This way, you have the flexibility to provide your own configuration, which is why you (nix-build) and hydra can confidently build the NixOS VM tests, bootable images, docker images, etc.

相关问答

更多
  • 欢迎来到Nix / NixOS :) 每当您需要了解有关错误的更多信息时,您可以使用--show-trace ,这会给您更详细的错误。 在你的情况下,你会看到类似的东西 error: while evaluating the attribute ‘passthru’ of the derivation ‘consul-0.7.0’ at /home/rok/tmp/consul.nix:6:3: cannot coerce a set to a string, at /home/rok/tmp/consul ...
  • haste-compiler被标记为“broken”: https://github.com/NixOS/nixpkgs/commit/37b1a0b79abd1d02d5618417b951cf02ef4f6a49 要覆盖,请将其放在.nixpkgs/config.nix : allowBroken = true; haste-compiler is marked "broken": https://github.com/NixOS/nixpkgs/commit/37b1a0b79abd1d02d5618 ...
  • 是一个Nix表达式,通过查看NIX_PATH环境变量和/或-I选项中的Nix搜索路径来NIX_PATH 。 在Nix手册中有更详细的描述。 请注意,在许多情况下,Nix搜索路径是不切实际的。 你只能从外面传递它,它很容易产生杂质。 根据我的经验,通过显式参数传递或与诸如callPackage和覆盖系统之类的callPackage相关的函数可以更好地解决问题。 例如,NixOS只有一个额外的搜索路径参数,如果没有给出明确的配置, nixos/default.nix在nixos/default ...
  • 我对nix一无所知,但是我从源代码中获得了相同的错误。 问题是无条件地包含在Linux控制台上检查ctrl-arrow键的代码段,导致构建在除Linux之外的任何系统上失败。 找到winio.c的整个部分(我手动下载的nano版本2.6.3上的507-523行),并将其删除(我把#ifdef TIOCLINUX放在它之前和#endif之后,但只是删除它,使用#if 0,或者将其注释也可以正常工作)如果你无法控制由nix构建的源代码,你可能需要通过其他方式安装nano(手动源编译,或macports,或fin ...
  • inherit cabal-install;的问题inherit cabal-install; 是cabal-install不是BASH中的有效变量名。 Nix将提供的集合中的键转换为BASH中的变量。 而不是inherit cabal-install; 你可以做一些像cabal_install = cabal-install; 然后在构建器中使用cabal_install 。 The problem with inherit cabal-install; is that cabal-install is ...
  • 我相信,默认情况下,不像plain cabal,nix会尝试使用分割对象功能来构建任何Haskell项目, 按照cabal的手册 : --enable系分割的OBJ 构建库时使用GHC -split-objs功能。 这样可以减少使用库的可执行文件的最终大小,只允许它们使用它们使用的位而不是整个库链接。 缺点是建立图书馆需要更长的时间,并使用更多的内存。 我不太确定为什么这可能会在您的系统上失败,但取决于您的nixpkgs版本可以通过添加以下项之一来禁用: enableSplitObjs = false; e ...
  • 简短的回答 buildPerlModule的结果意味着在mkDerivation params中用作src 。 答案很长 事实证明, sqitch已经是nixpkgs的一部分,它的定义如下: https://github.com/NixOS/nixpkgs/blob/56904d7c423f2b13b37fbd29f39bbb4b52bc7824/pkgs/development/tools/misc/sqitch/default.nix { name, stdenv, perl, makeWrapper, ...
  • 从问题的数量来看,问题是非常具体的。 但是,我以某种方式找到了解决方案。 导出到Eclipse项目后,我创建了builder.sh文件: export NIX_PATH=nixpkgs=/home/xxxx/.nix-defexpr/channels/nixpkgs /home/xxxx/.nix-profile/bin/nix-shell default.nix --run "make $1" 然后我在C \ C ++ General - > C \ C ++ Make Project中将文件设置为构建 ...
  • 以下可能是OSX特有的: Nix通道基于每个用户( 源 )进行管理。 nix-channel --list的输出为空,因为默认情况下你没有订阅任何频道 - 只有root订阅了nixpkgs-unstable ( source )。 您可以以root身份运行nix-channel --list来查看他的订阅。 但 不要通过sudo运行它(参见: https : //github.com/NixOS/nix/issues/1548 )和 不要使用简单的sudo su因为它不加载/ etc / profile( ...
  • 每次调用nix-shell时,它都会计算当前src中的whats的散列,如果它还不存在,则将其复制到散列名下的nix存储中。 所以改变src内容最终会导致新的哈希。 对于派生属性集中的所有路径都是如此; 它们都被复制到nix商店。 当然,当你进行适当的安装时会发生同样的事情。 Each time you invoke nix-shell it will compute the hash of whats currently in src and copy it to the nix store under ...

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)