お世話になっております。
WebClient.uploadFileを用いて、IISのWebサーバに
1GB程度のファイルを送信する機能を実装しております。
しかし、30MBを超えるファイルを送信すると404エラーが発生します。
ASP.NETで28~30MB以上のファイルアップロードで404エラーが発生する (ASP.NET プログラミング)
上記の対策を行いましたが、解決しませんでした。
28MB以下のファイルは送信することができるため、
クライアント側の問題というよりIISの問題のように思っておりますが、
原因が分かりません。
対策をご存知の方がいましたら、ご教授頂けますでしょうか。
ソースは以下になります。
- クライアント
Form1.vb
Imports System.Net Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim webClient As WebClient = New WebClient() Dim url As String = "http://[サーバのIPアドレス]/upload.aspx" Dim filePath As String = "C:\tmp.txt" webClient.UploadFile(url, filePath) webClient.Dispose() webClient = Nothing End Sub End Class
- サーバ
upload.aspx
<%@ Import Namespace="System"%> <%@ Import Namespace="System.IO"%> <%@ Import Namespace="System.Net"%> <%@ Import NameSpace="System.Web"%> <Script language="VB" runat=server> Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Dim file Dim fileList = Request.Files.AllKeys For Each f In fileList file = Request.Files(f) file.SaveAs("C:\inetpub\wwwroot\" & file.FileName) Next f End Sub </Script> <html> <body> <p> Upload complete. </p> </body> </html>
web.config
<?xml version="1.0" encoding="utf-8"?> <!-- ASP.NET アプリケーションの構成方法の詳細については、 https://go.microsoft.com/fwlink/?LinkId=169433 を参照してください --> <configuration> <system.web> <compilation debug="true" strict="false" explicit="true" targetFramework="4.6.1" /> <httpRuntime executionTimeout="90" maxRequestLength="1073741824" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" enableVersionHeader="true" /> </system.web> <system.webServer> <security> <requestFiltering> <requestLimits maxAllowedContentLength="1073741824"/> </requestFiltering> </security> </system.webServer> </configuration>
またバージョンは以下です。
.net FrameWork 4.7.1
IIS 7.5です。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/02/16 03:07