B
Bruce
I am creating a Windows Forms client app working in conjunction with Web
Services on our Windows 2003 server, for remote file acess. (The files are
serialized into byte[] objects for file xfer in the Web Services messages on
the up/down directions.) During testing today, I noticed that file uploads
to the server seem to fail whenever the enclosed file is larger than about
1-2 Mbytes. Is there some inherent size limit on .NET-generated SOAP
messages? If so, can I modify it, or will I have to do some hoop jumping to
break large files into multiple messages?
A code example is attached. m_Server is the proxy on the client, and
m_Server.Upload() is a Web Services method on the server.
Thanks,
Bruce
------------
public bool UploadAsset( User user, Asset asset, ArrayList
groupNames )
{
byte [] fileBytes; // xml image of the Asset's binary file.
long globalSN = -1L;
FileStream fs = null;
FileInfo inf = new FileInfo( asset.FileSpec );
if ( !inf.Exists )
{
MessageBox.Show( "Error reading file: " + asset.FileSpec );
return false;
}
try
{
fs = new FileStream( asset.FileSpec, FileMode.Open,
FileAccess.Read );
fileBytes = new byte[inf.Length];
fs.Read( fileBytes, 0, (int)inf.Length );
fs.Close();
}
catch ( Exception ex )
{
MessageBox.Show( "Error reading file: " + asset.FileSpec +
", Exception: " + ex.Message );
return false;
}
// Send it up to the server...
try
{
globalSN = m_Server.Upload(user.UserName, user.PassWord,
asset.FileName,
fileBytes, asset.TypeName, asset.Description,
groupNames.ToArray());
asset.SerialNumber = globalSN;
}
catch (Exception ex)
{
// Trigger event to inform subscribers of connectivity failure.
ServerConnEvent(this, new ServerConnEventArgs(false));
}
return (globalSN != -1L);
}
Services on our Windows 2003 server, for remote file acess. (The files are
serialized into byte[] objects for file xfer in the Web Services messages on
the up/down directions.) During testing today, I noticed that file uploads
to the server seem to fail whenever the enclosed file is larger than about
1-2 Mbytes. Is there some inherent size limit on .NET-generated SOAP
messages? If so, can I modify it, or will I have to do some hoop jumping to
break large files into multiple messages?
A code example is attached. m_Server is the proxy on the client, and
m_Server.Upload() is a Web Services method on the server.
Thanks,
Bruce
------------
public bool UploadAsset( User user, Asset asset, ArrayList
groupNames )
{
byte [] fileBytes; // xml image of the Asset's binary file.
long globalSN = -1L;
FileStream fs = null;
FileInfo inf = new FileInfo( asset.FileSpec );
if ( !inf.Exists )
{
MessageBox.Show( "Error reading file: " + asset.FileSpec );
return false;
}
try
{
fs = new FileStream( asset.FileSpec, FileMode.Open,
FileAccess.Read );
fileBytes = new byte[inf.Length];
fs.Read( fileBytes, 0, (int)inf.Length );
fs.Close();
}
catch ( Exception ex )
{
MessageBox.Show( "Error reading file: " + asset.FileSpec +
", Exception: " + ex.Message );
return false;
}
// Send it up to the server...
try
{
globalSN = m_Server.Upload(user.UserName, user.PassWord,
asset.FileName,
fileBytes, asset.TypeName, asset.Description,
groupNames.ToArray());
asset.SerialNumber = globalSN;
}
catch (Exception ex)
{
// Trigger event to inform subscribers of connectivity failure.
ServerConnEvent(this, new ServerConnEventArgs(false));
}
return (globalSN != -1L);
}