FileUp
Topic: Re: System.Runtime.InteropServices.COMException: Interface not registered

SoftArtisans Forums

Page 1 of 1 (4 items)


Posted by Kavita_Pr on 06-21-2006 8:11 AM

Hello,

 I have downloaded “FileUp Professional Edition V5.0.14” Evaluation Software from www.softartisans.com. I had built a sample .Net application for uploading files. At first I was able to run the application without any error. But suddenly in between, it started giving error:

System.Runtime.InteropServices.COMException: Interface not registered
Line 45: FileUp oFileUp = new FileUp(Context);

[COMException (0x80040155): Interface not registered]
   System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) +0
   System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode) +34
   SoftArtisans.Net.FileUpShim.__ctor(FileUpShim* , HttpContext pHttpCtxt) +911
   SoftArtisans.Net.FileUp..ctor(HttpContext Context) +210
   BulkUpload.UploadMultipleFiles.ProcessUpload() in c:\inetpub\wwwroot\bulkupload\uploadmultiplefiles.aspx.cs:45
   BulkUpload.UploadMultipleFiles.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\bulkupload\uploadmultiplefiles.aspx.cs:16
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061


I followed all steps for installing the dlls given on site “support.softartisans.com/docs/FileUp/install_dotnet.htm”. 

System details on which this application is created:
 OS: Windows 2000 server
.Net Framework 1.1

 The code is as below:
//--- Instantiate FileUp
FileUp oFileUp = new FileUp(Context);
//--- This StringBuilder will be used to display results
System.Text.StringBuilder results = new System.Text.StringBuilder();
try
{
//--- Set the Path property to the location you wish to
//--- temporarily cache the incoming file before saving
//--- Note: This property must be set immediately after
//--- instantiating the FileUp object
oFileUp.Path = "C:\\temp";
//--- Write the table header
results.Append("<DIV ALIGN=center><H3>Upload Results</H3></DIV>");
results.Append("<TABLE WIDTH=90% ALIGN=center BORDER=1>");
results.Append("<TH>Element type</TH><TH>Element Name</TH><TH>Value</TH>");
//--- This main loop will iterate through every submitted form element
//--- Within the loop, we'll test it to see if it's a file or a text form
//--- element. If it's a text form element, we'll see if it's a single-value
//--- or a subcollection
foreach(object item in oFileUp.FormEx)
{
//--- ASP.NET submits several hidden fields
//--- with every PostBack for internal use such as
//--- __VIEWSTATE. Those hidden fields begin with
//--- a double-underscore. We'll ignore these.
if(item.ToString().StartsWith("__"))
continue;
//--- Get a reference for the current form element
//--- in the iteration
SaMultiSelectCollection oFormExItem = (SaMultiSelectCollection)oFileUp.FormEx[item];
results.Append("<TR>");
//--- If there is more than one subitem in the current
//--- form element, it's a multiselect collection
//--- In this case, loop over the subitems
if(oFormExItem.Count > 1)
{
results.Append("<TD>Subcollection</TD><TD>" + item.ToString() + "</TD><TD>");
//--- Loop over the subitems of the current form element
foreach(object subitem in oFormExItem)
{
results.Append("<LI>" + subitem.ToString());
}
results.Append("</TD>");
}
//--- If there's only one item in the form element
//--- then it's not a multiselect collection
//--- We'll test to see if it's a file or a
//--- standard form element
else
{
//--- If it's a SaFile object, it's a file
if(oFormExItem[1] is SaFile)
{
SaFile oFile = (SaFile)oFormExItem[1];
//--- Check to be sure the file element isn't empty
if(!oFile.IsEmpty)
{
//--- It's not empty, so we'll save it
oFile.Save();
results.Append("<TD>File</TD><TD>" + item.ToString() + "</TD><TD>Saved as: " + oFile.ServerName + "</TD>");
}
else
{
//--- It's empty, just write a message
results.Append("<TD>File</TD><TD>" + item.ToString() + "</TD>" +
"<TD>(empty)</TD>");
}
}
//--- If it's "string", it's just a standard
//--- form element
else if(oFormExItem[1] is string)
{
results.Append("<TD>Form single value</TD><TD>" + item.ToString() + "</TD><TD>" +oFormExItem[1].ToString() + "</TD>");
}
}
results.Append("</TR>");
}
results.Append("</TABLE>");
//--- Display the results on the webform
lbl.Text = results.ToString();
}
catch(Exception ex)
{
//--- Show a message if an exception is caught
Response.Write("<b>An exception has occurred</b><br>" +ex.Message);
}
finally
{
//--- Always call Dispose in the finally block
if(oFileUp!=null)
oFileUp.Dispose();
oFileUp =
null;
}

Thanks & Regards,


Posted by Charlie on 06-22-2006 4:35 PM
The error would lead me to believe that for some reason FileUp is no longer registered with COM.  Please do the following at a command prompt:

1) Navigate to the directory which contains FileUp's dlls for use with .NET, usually C:\Program Files\SoftArtisans\FileUp\dotnet\

>cd \Program Files\SoftArtisans\FileUp\dotnet\

2) Register the three FileUp dlls with COM.  (This is necessary because FileUp is a mixed COM/.NET product.)

>regsvr32 safileup.dll

>regsvr32 safupps.dll

>regsvr32 saprgres.dll


3) Reset IIS.

>iisreset

Try running your application again.

Posted by Kavita_Pr on 06-22-2006 11:58 PM
I had tried following the steps given by you. But it still gives the same error.

Posted by phamhoang on 08-08-2006 5:26 AM
Hi,

I 've had the same problem with FileUp on my Win2000. I've tried to reinstall FileUp and chosed 'No' for this question "Would you like to register FileUp with MTS/COM+ for transactional uploads? This is not required and can be done after installation." during the installation. It works well now.
I suggest you to try this way to resolve the problem.

Good luck,

PHAM Hoang