使用 AppSelfHostBase 的自托管服務(wù)堆棧主機(jī)有一個(gè)服務(wù)方法:public object Any(UploadImageRequest request){ // Need to make sure the file is not too large!}[Route("/UploadImage")]public class UploadImageRequest : IRequiresRequestStream{ public Stream RequestStream { get; set; }}
1 回答

拉莫斯之舞
TA貢獻(xiàn)1820條經(jīng)驗(yàn) 獲得超10個(gè)贊
我實(shí)際上找到了一種可能的方法:
public object Any(UploadImageRequest request)
{
if (Request.ContentLength > 10 * 1024 * 1024)
{
return new HttpResult($"Image too large!", HttpStatusCode.RequestEntityTooLarge);
}
...
}
- 1 回答
- 0 關(guān)注
- 142 瀏覽
添加回答
舉報(bào)
0/150
提交
取消