H
Homer J.
I have a web app that works very well for small blobs. I have recently
decided to add the ability to upload *.wmv's and eBooks, both of which range
in size from 10 to 60mb's, but I've ran into a little problem. I'm getting a
404 error about half way through the process. I've included my upload code
below:
*Begin*****************************************************
strConnection =
ConfigurationManager.ConnectionStrings["TechVaultConnectionString"].ConnectionString;
dbConn = new SqlConnection(strConnection);
dbConn.Open();
dcmd = new SqlCommand();
dcmd.CommandText = "INSERT INTO
[CalexanTechVault].[dbo].[tblVault] " +
"([tID] " +
",[FileName] " +
",[FileDesc] " +
",[Filesize] " +
",[FileData] " +
",[MIMEType] " +
",[FileType] " +
",[uBy] " +
",[uDate]) " +
"VALUES " +
"(@tID " +
",@FileName " +
",@FileDesc " +
",@Filesize " +
",@FileData " +
",@MIMEType " +
",@FileType " +
",@uBy " +
",@uDate)";
dcmd.Parameters.Add(new SqlParameter("@tID", SqlDbType.Int));
dcmd.Parameters["@tID"].Value = Session["Tumbler"].ToString();
dcmd.Parameters.Add(new SqlParameter("@Filename",
SqlDbType.VarChar));
dcmd.Parameters["@Filename"].Value = FileUpload1.FileName;
dcmd.Parameters.Add(new SqlParameter("@FileDesc",
SqlDbType.VarChar));
dcmd.Parameters["@FileDesc"].Value =
FileDescTextBox.Text.ToString();
dcmd.Parameters.Add(new SqlParameter("@Filesize",
SqlDbType.VarChar));
dcmd.Parameters["@Filesize"].Value =
FileUpload1.PostedFile.ContentLength;
dcmd.Parameters.Add(new SqlParameter("@FileData",
SqlDbType.VarBinary));
dcmd.Parameters["@FileData"].Value = FileUpload1.FileBytes;
dcmd.Parameters.Add(new SqlParameter("@MIMEType",
SqlDbType.VarChar));
dcmd.Parameters["@MIMEType"].Value = mimeType;
dcmd.Parameters.Add(new SqlParameter("@FileType",
SqlDbType.VarChar));
dcmd.Parameters["@FileType"].Value =
fileExtension.Substring(1, fileExtension.Length - 1);
dcmd.Parameters.Add(new SqlParameter("@uBy",
SqlDbType.VarChar));
dcmd.Parameters["@uBy"].Value = Session["UserID"].ToString();
dcmd.Parameters.Add(new SqlParameter("@uDate",
SqlDbType.SmallDateTime));
dcmd.Parameters["@uDate"].Value = DateTime.Now.Date;
dcmd.CommandTimeout = 30000;
dcmd.Connection = dbConn;
dcmd.ExecuteNonQuery();
*End*****************************************************
I added the CommandTimeout this morning thinking that that might be the
problem. No luck. Below is the httpRuntime from my Web.Config:
*Begin*****************************************************
<httpRuntime executionTimeout="500" maxRequestLength="61440"
useFullyQualifiedRedirectUrl="false" minFreeThreads="8"
minLocalRequestFreeThreads="4" requestLengthDiskThreshold="1024"
appRequestQueueLimit="100" />
*End*****************************************************
Updating this hasn't worked either. I've over inflated the numbers just to
ensure that there is enough time and size. One thing that I have noticed is
that if I'm running the app in debug mode via Visual Studio I don't get the
problem. It's only when I go through IIS7.0. So...let's look at the web
now. Changed the Connection timeout to 300 seconds. Still no luck.
If anyone has an idea I'd greatly appreciate it.
Thanks
decided to add the ability to upload *.wmv's and eBooks, both of which range
in size from 10 to 60mb's, but I've ran into a little problem. I'm getting a
404 error about half way through the process. I've included my upload code
below:
*Begin*****************************************************
strConnection =
ConfigurationManager.ConnectionStrings["TechVaultConnectionString"].ConnectionString;
dbConn = new SqlConnection(strConnection);
dbConn.Open();
dcmd = new SqlCommand();
dcmd.CommandText = "INSERT INTO
[CalexanTechVault].[dbo].[tblVault] " +
"([tID] " +
",[FileName] " +
",[FileDesc] " +
",[Filesize] " +
",[FileData] " +
",[MIMEType] " +
",[FileType] " +
",[uBy] " +
",[uDate]) " +
"VALUES " +
"(@tID " +
",@FileName " +
",@FileDesc " +
",@Filesize " +
",@FileData " +
",@MIMEType " +
",@FileType " +
",@uBy " +
",@uDate)";
dcmd.Parameters.Add(new SqlParameter("@tID", SqlDbType.Int));
dcmd.Parameters["@tID"].Value = Session["Tumbler"].ToString();
dcmd.Parameters.Add(new SqlParameter("@Filename",
SqlDbType.VarChar));
dcmd.Parameters["@Filename"].Value = FileUpload1.FileName;
dcmd.Parameters.Add(new SqlParameter("@FileDesc",
SqlDbType.VarChar));
dcmd.Parameters["@FileDesc"].Value =
FileDescTextBox.Text.ToString();
dcmd.Parameters.Add(new SqlParameter("@Filesize",
SqlDbType.VarChar));
dcmd.Parameters["@Filesize"].Value =
FileUpload1.PostedFile.ContentLength;
dcmd.Parameters.Add(new SqlParameter("@FileData",
SqlDbType.VarBinary));
dcmd.Parameters["@FileData"].Value = FileUpload1.FileBytes;
dcmd.Parameters.Add(new SqlParameter("@MIMEType",
SqlDbType.VarChar));
dcmd.Parameters["@MIMEType"].Value = mimeType;
dcmd.Parameters.Add(new SqlParameter("@FileType",
SqlDbType.VarChar));
dcmd.Parameters["@FileType"].Value =
fileExtension.Substring(1, fileExtension.Length - 1);
dcmd.Parameters.Add(new SqlParameter("@uBy",
SqlDbType.VarChar));
dcmd.Parameters["@uBy"].Value = Session["UserID"].ToString();
dcmd.Parameters.Add(new SqlParameter("@uDate",
SqlDbType.SmallDateTime));
dcmd.Parameters["@uDate"].Value = DateTime.Now.Date;
dcmd.CommandTimeout = 30000;
dcmd.Connection = dbConn;
dcmd.ExecuteNonQuery();
*End*****************************************************
I added the CommandTimeout this morning thinking that that might be the
problem. No luck. Below is the httpRuntime from my Web.Config:
*Begin*****************************************************
<httpRuntime executionTimeout="500" maxRequestLength="61440"
useFullyQualifiedRedirectUrl="false" minFreeThreads="8"
minLocalRequestFreeThreads="4" requestLengthDiskThreshold="1024"
appRequestQueueLimit="100" />
*End*****************************************************
Updating this hasn't worked either. I've over inflated the numbers just to
ensure that there is enough time and size. One thing that I have noticed is
that if I'm running the app in debug mode via Visual Studio I don't get the
problem. It's only when I go through IIS7.0. So...let's look at the web
now. Changed the Connection timeout to 300 seconds. Still no luck.
If anyone has an idea I'd greatly appreciate it.
Thanks