Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have 1 Gb Video File Upload in my server folder ,But error generate

Error :

HTTP Error 404.13 - Not Found
The request filtering module is configured to deny a request that exceeds the request content length.
Most likely causes:

Request filtering is configured on the Web server to deny the request because the content length exceeds the configured value.

Things you can try:

Verify the configuration/system.webServer/security/requestFiltering/requestLimits@maxAllowedContentLength setting in the applicationhost.config or web.config file.

-------------------------------------------------------
i have Above error related Search , So some solution give me like as

1) <httpruntime targetframework="4.5" executiontimeout="90">maxrequestlength="4096">
useFullyQualifiedRedirectUrl="false" minFreeThreads="8"
minLocalRequestFreeThreads="4"
appRequestQueueLimit="100" enableVersionHeader="true" />

2)<httpruntime executiontimeout="240" maxrequestlength="20480">

------------------------------------------------------------------
Above Solution i have try but not solve this error,

Please Give me solution , i have 2 Gb Or More size no limit size file upload in server folder give me solution fast(i think multiparty type to solve but don't know how to solve ..)
Posted
Updated 27-Jan-15 22:45pm
v4

The problem is that inside your web.config your default size for the file is set to be 4mb (4mb is default, so even if there is no settings set then 4mb size would be define as the value for maxRequestSize attribute of the HttpRunTime).

A solution to this would, be, to change that value and update it to make it of your own choice.

Following shows an example of that, you can definitely add more attributes to create (or maintain or update) your configuration of the website in IIS.

HTML
<configuration>
   <system.web>
      <httpruntime maxrequestlength="100000" />
   </system.web>
</configuration>


Note: The file size in above method is 100mb (less than that of course because an MB is of 1024kb not 1000kb), size defined is in kilobytes. For more on this, please read this documentation. https://msdn.microsoft.com/en-us/library/e1f13641%28v=vs.71%29.aspx
 
Share this answer
 
Comments
BirjuGohel 28-Jan-15 4:49am    
Thanks,
Not a solution,
This tag all ready add in my web config but not solve this problem give me other solution
Afzaal Ahmad Zeeshan 28-Jan-15 5:06am    
What is the value for this attribute inside your web.config file?
BirjuGohel 28-Jan-15 5:49am    
executionTimeout="1800" maxRequestLength="2097151000"

My Value is this
And Create Error (Non-negative number required.)-1980319372

=-----------------I have my code display u .......................


protected void Button1_Click(object sender, EventArgs e)
{
string finam= @"E:\MV\Rio.mkv";
UploadFile(finam);
}

private void UploadFile(string filename)
{


// get the exact file name from the path

String strFile = System.IO.Path.GetFileName(filename);

// create an instance fo the web service
MyWebService srv = new MyWebService();

// get the file information form the selected file

FileInfo fInfo = new FileInfo(filename);


long numBytes = fInfo.Length;

double dLen = Convert.ToDouble(fInfo.Length / 502000000);

FileStream fStream = new FileStream(filename, FileMode.Open, FileAccess.Read);

BinaryReader br = new BinaryReader(fStream);


byte[] data = br.ReadBytes((int)numBytes);
above Line Given Error..................................


br.Close();



// pass the byte array (file) and file name to the web service

bool sTmp = srv.UploadDocumentmovie(data, strFile);


fStream.Close();

fStream.Dispose();
}

Please Give me .....Solution And Web Config File i have give the tag...above first ..
I have solution this problem ..



[WebMethod]
public void UploadFileServer()//string filename
{
string filename = @"D:\Old Songs\R.D.Burman\019__HUMEIN_TUMSE_PYAAR_KIT.MP3"; // @"D:\Old Songs\R.D.Burman\015__SAGAR_KINARE.MP3"; //+ System.IO.Path.GetFileName(fileUpload1.PostedFile.FileName); // + System.IO.Path.GetFileName(fileUpload1.PostedFile.FileName); //@"E:\MV\Rio.mkv";//@"E:\Downloads\movie\Noah.2013.BRRiP.XVID.AC3-MAJESTIC\Noah.2013.BRRiP.XVID.AC3-MAJESTIC.avi"; //@"E:\MV\Rio.mkv";//
try
{
// get the exact file name from the path
String strFile = System.IO.Path.GetFileName(filename);

// create an instance fo the web service

//TestUploader.Uploader.FileUploader srv = new
//TestUploader.Uploader.FileUploader();

MyWebService srv = new MyWebService();

// get the file information form the selected file
FileInfo fInfo = new FileInfo(filename);

// get the length of the file to see if it is possible
// to upload it (with the standard 4 MB limit)
long numBytes = fInfo.Length;
double dLen = Convert.ToDouble(fInfo.Length / 10000000000);

// Default limit of 4 MB on web server
// have to change the web.config to if
// you want to allow larger uploads
if (dLen < 5000000)
{
// set up a file stream and binary reader for the
// selected file
FileStream fStream = new FileStream(filename, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fStream);

// convert the file to a byte array
byte[] data = br.ReadBytes((int)numBytes);
br.Close();

// pass the byte array (file) and file name to the web service
// string sTmp = srv.UploadFile(data, strFile);
string sTmp = TransferFile(data,strFile);
fStream.Close();
fStream.Dispose();

// this will always say OK unless an error occurs,
// if an error occurs, the service returns the error message

Console.WriteLine("File Upload Status: " + sTmp, "File Upload");

}
else
{
// Display message if the file was too large to upload
Console.WriteLine("The file selected exceeds the size limit for uploads.", "File Size");
}
}
catch (Exception ex)
{
// display an error message to the user
//MessageBox.Show(ex.Message.ToString(), "Upload Error");
Console.WriteLine(ex.ToString());
}
}





// Method Store in server folder
private FtpWebRequest ftpRequest = null;
//private FtpWebResponse ftpResponse = null;
private Stream ftpStream = null;
private int bufferSize = 5048;


public string TransferFile(byte[] fileContent,string filename) //File file //byte[] file, string filename
{
//int l = Convert.ToInt32(file.Leanth);

// byte[] binaryWriteArray = new byte[file[0].InputStream.Length];

//HttpContext postedContext = HttpContext.Current;

//byte[] data = br.ReadBytes((int)numBytes);


string strMsg = string.Empty;
try
{

/* Create an FTP Request */
String uploadUrl = String.Format("{0}/{1}/{2}", "ftp://abc.co.in//VoiceChatServiceApp", "/UplodadedAudio/", filename);
// HttpWebRequest ftpRequest = (HttpWebRequest)WebRequest.Create(uploadUrl);
ftpRequest = (FtpWebRequest)FtpWebRequest.Create(uploadUrl);
/* Log in to the FTP Server with the User Name and Password Provided */
ftpRequest.Credentials = new NetworkCredential("UserName", "Password");
/* When in doubt, use these options */
//ftpRequest.UseBinary = true;
//ftpRequest.UsePassive = true;
//ftpRequest.KeepAlive = true;
/* Specify the Type of FTP Request */
ftpRequest.Method = WebRequestMethods.Ftp.UploadFile;
try
{

ftpRequest.ContentLength = fileContent.Length;

Stream requestStream = ftpRequest.GetRequestStream();
requestStream.Write(fileContent, 0, fileContent.Length);
requestStream.Close();
//FtpWebResponse response = (FtpWebResponse)ftpRequest.GetResponse();
//HttpWebResponse response = (HttpWebResponse)ftpRequest.GetResponse();
//strMsg = "File Upload Status: " + response.ToString();

}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
/* Resource Cleanup */
ftpStream.Close();
ftpRequest = null;
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}

return strMsg;

}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900