首页 \ 问答 \ NancyFX / Linux / Mono - 大型上传(超过1MB)可以在Windows服务器上运行,但不能在Linux上运行(NancyFX/Linux/Mono - Large uploads (over 1MB) work on windows server but not linux)

NancyFX / Linux / Mono - 大型上传(超过1MB)可以在Windows服务器上运行,但不能在Linux上运行(NancyFX/Linux/Mono - Large uploads (over 1MB) work on windows server but not linux)

我似乎有一个相当奇怪的问题,我想知道是否有人可以阐明。

我正在编写一个Android应用程序,它从自托管的C#服务器上传/下载文件。 服务器是用C#编写的(使用NancyFX自主机),Android应用程序使用HttpClient(Apache)与服务器通信。

当我尝试上传Windows上的文件(我手动调试到服务器代码的位置)时,上传适用于任意长度的任意数量的文件。 一切都按预期工作,小文件和大文件都上传。

但是,当我将此服务器部署到我的Linux机箱(OpenSuSe)并运行它时,上传的行为会有所不同。 较小的文件(<1MB)仍然按预期工作,但当文件超过此限制时,HttpClient的.execute()将无限期挂起。 我试图将套接字超时设置为10秒(测试),我曾经收到套接字超时异常,但有时,它只是挂在那里,甚至没有超时。 还值得一提的是,请求永远不会到达服务器 ,这可能意味着问题很可能不是南希服务器(虽然我可能是错的)。

鉴于问题的性质,我倾向于认为问题出在Linux服务器配置的某个地方,不管出于什么原因都不允许更大的POST请求,但我无法弄清楚为什么会出现这种情况。 我在同一个Linux机器上有一台PHP服务器,我可以上传大于1MB的文件,没有任何问题。

我尝试过的其他步骤:我已经在Linux服务器上禁用了防火墙以查看它是否是防火墙问题(因为<1MB很少到达服务器就不太可能),但这没有用。 我还将MTU改为与我的Windows机器一致,但这也没有什么区别。

就目前而言,我没有想法。 有谁知道如何进一步追踪这个以解决问题的根源? 任何帮助将不胜感激。

提前谢谢了。


I seem to have a rather strange problem which I was wondering if anyone could shed a light on.

I am writing an Android app which uploads/downloads files from a self hosted C# server. The server is written in C# (using NancyFX self-host) and the Android app is using HttpClient (Apache) to talk to the server.

When I attempt to upload the files on windows (which is where I manually debug into the server code), the upload works fine for any number of files with any arbitrary length. Everything works as expected and both small and large files get uploaded.

However, when I deploy this server to my Linux box (OpenSuSe) and run it, the uploads behave differently. The smaller files (< 1MB) still work as expected but when the file goes over this limit, the HttpClient's .execute() hangs indefinitely. I tried to set the socket timeout to 10 seconds (to test) and I once received a socket timeout exception but other times, it simply hung there, never even timing out. It's also worth mentioning that the request never reaches the server which would implicate that the problem is most probably not with the Nancy server (although I could be wrong).

Given the nature of the problem, I'm inclined to believe that the problem lies somewhere in the Linux server configuration which does not allow larger POST requests for whatever reason but I've not been able to figure out why that would be the case. I do have a PHP server on that very same Linux box and on that, I can upload files larger than 1MB without any problems.

Other steps I've tried: I've disabled the firewall on the Linux server to see if it was a firewall problem (highly unlikely since <1MB reaches the server just fine) but that didn't help. I also changed the MTU to be in-line with my windows machine but that did not make a difference either.

As it stands, I'm out of ideas. Does anyone know how to trace this further to get to the bottom of the problem? Any help would be greatly appreciated.

Many thanks in advance.


原文:
更新时间:2022-09-19 21:09

最满意答案

我已经改变了一下你的代码并且运行良好:

1.您在代码中忘记创建id="gender"的小部件

2. reactiveValues(df=NULL)

3.数据表输出代码:

output$nText<- renderDataTable({ datatable(values$df, options = list(orderClasses = TRUE,lengthMenu = c(5, 10, 30), pageLength = 5))})

这是完整的应用程序代码:

library(shiny)
library(shinydashboard)
library(DT)


ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(disable = TRUE),
  dashboardBody(
    tabItem(tabName = "signup",
            fluidRow(
              box(textInput("name",  "이름"),
                  textInput("gender",  "이름"),
                  selectInput("college", "대학",
                              choices = list("간호대학", "경영대학",
                                             "공과대학", "농업생명과학대학",
                                             "미술대학", "법과대학",
                                             "사범대학", "사회과학대학",
                                             "수의과대학", "생활과학대학",
                                             "약학대학", "음악대학",
                                             "인문대학", "의과대학",
                                             "자연과학대학", "기타"),
                              selected = 1),
                  selectInput("team", "교내 소속축구팀",
                              choices = list("싸커21", "아르마다",
                                             "에코플러스", "아크로",
                                             "P.O.S", "공대",
                                             "자연대", "관악사",
                                             "농대축구부 휘모리", "지오싸카스",
                                             "새츠", "샥스",
                                             "FC SEES", "Cells United",
                                             "프리템포", "남풍",
                                             "없음")),
                  textInput("score", "점수"),
                  actionButton("click_counter","Submit")),
              box(DT::dataTableOutput("nText"))
            )
  )))

server <- shinyServer(function(input, output, session) {

  values<- reactiveValues(df = NULL) 
  #values$df<- data.frame()

  observeEvent(input$click_counter, {
    name<- input$name
    gender<- input$gender
    college<- input$college
    team<- input$team
    score<- as.numeric(input$score)
    rank<- 0

    new_row<- data.frame(rank,name,college,gender,team,score)

    values$df<- rbind(values$df, new_row)
    values$df<- values$df[order(values$df$score,decreasing=TRUE),]
    #print(values$df)
    values$df$rank<- 1:nrow(values$df) 
  })

  output$nText<- renderDataTable({
    datatable(values$df, options = list(orderClasses = TRUE,lengthMenu = c(5, 10, 30), pageLength = 5))})
})

shinyApp(ui = ui, server = server)

I have changed a bit Your code and it is working well:

1. You forgot in Your code to create a widget with id="gender"

2. reactiveValues(df=NULL)

3. datatable output code :

output$nText<- renderDataTable({ datatable(values$df, options = list(orderClasses = TRUE,lengthMenu = c(5, 10, 30), pageLength = 5))})

Here is the full App code:

library(shiny)
library(shinydashboard)
library(DT)


ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(disable = TRUE),
  dashboardBody(
    tabItem(tabName = "signup",
            fluidRow(
              box(textInput("name",  "이름"),
                  textInput("gender",  "이름"),
                  selectInput("college", "대학",
                              choices = list("간호대학", "경영대학",
                                             "공과대학", "농업생명과학대학",
                                             "미술대학", "법과대학",
                                             "사범대학", "사회과학대학",
                                             "수의과대학", "생활과학대학",
                                             "약학대학", "음악대학",
                                             "인문대학", "의과대학",
                                             "자연과학대학", "기타"),
                              selected = 1),
                  selectInput("team", "교내 소속축구팀",
                              choices = list("싸커21", "아르마다",
                                             "에코플러스", "아크로",
                                             "P.O.S", "공대",
                                             "자연대", "관악사",
                                             "농대축구부 휘모리", "지오싸카스",
                                             "새츠", "샥스",
                                             "FC SEES", "Cells United",
                                             "프리템포", "남풍",
                                             "없음")),
                  textInput("score", "점수"),
                  actionButton("click_counter","Submit")),
              box(DT::dataTableOutput("nText"))
            )
  )))

server <- shinyServer(function(input, output, session) {

  values<- reactiveValues(df = NULL) 
  #values$df<- data.frame()

  observeEvent(input$click_counter, {
    name<- input$name
    gender<- input$gender
    college<- input$college
    team<- input$team
    score<- as.numeric(input$score)
    rank<- 0

    new_row<- data.frame(rank,name,college,gender,team,score)

    values$df<- rbind(values$df, new_row)
    values$df<- values$df[order(values$df$score,decreasing=TRUE),]
    #print(values$df)
    values$df$rank<- 1:nrow(values$df) 
  })

  output$nText<- renderDataTable({
    datatable(values$df, options = list(orderClasses = TRUE,lengthMenu = c(5, 10, 30), pageLength = 5))})
})

shinyApp(ui = ui, server = server)

相关问答

更多

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)