If I try to use System.Runtime.InteropServices.Marshal.ReleaseComObject
(xxx) I get the error Specified cast is not valid
Serviced Component Begins as follows:
Imports System.EnterpriseServices
Imports System.Runtime.InteropServices
Imports PowerPoint = Microsoft.Office.Interop.PowerPoint
Imports Office = Microsoft.Office.Core
Imports Graph = Microsoft.Office.Interop.Graph
Imports System.IO
#Region " Interfaces "
Public Interface IRemotePowerPoint
Function GetPPTPresentation() As Byte()
End Interface
#End Region
' COM Interop Attributes
<Serializable(), _
GuidAttribute("851CA052-02B0-4cfa-9C00-8A7A68FC1B95"), _
ClassInterfaceAttribute(ClassInterfaceType.AutoDual), _
TransactionAttribute(TransactionOption.Supported), _
JustInTimeActivationAttribute(), _
EventTrackingEnabledAttribute(), _
ComVisible(True)> _
Public Class RemotePowerPoint
Inherits ServicedComponent
Implements IRemotePowerPoint
Client Code is as follows:
Private Sub btnGenerate_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnGenerate.Click
Dim objRemotePPT As RemotePowerpoint.IRemotePowerPoint
Dim FileSaveLocation As String
Dim strMessage As String = Dns.GetHostByName
(Dns.GetHostName).AddressList(0).ToString()
Dim strPath As String
Dim objMemoryStream As MemoryStream
Try
objRemotePPT = New RemotePowerpoint.RemotePowerPoint
If File.Exists(m_FilePath2 & m_FileName2) Then
File.Delete(m_FilePath2 & m_FileName2)
End If
Dim bytesRead As Byte() = objRemotePPT.GetPPTPresentation
Dim objReturnStream As FileStream = New FileStream(m_FilePath2
& m_FileName2, FileMode.CreateNew, FileAccess.Write)
objReturnStream.Write(bytesRead, 0, bytesRead.Length)
objReturnStream.Close()
If File.Exists(m_FileName2) Then
Response.Write("<script language='javascript'>")
Response.Write("window.open('" & m_FileName2 & "')
</script>")
Response.Write("window.location = '" & m_FileName2
& "';</script>")
End If
Catch ex As Exception
WriteEventError("RemotePPT", ex.Message)
Finally
objMemoryStream = Nothing
End Try
On Mon, 1 Nov 2004 16:46:45 -0500, Adam Tuliper <[EMAIL PROTECTED]>
wrote:
>If Runtime.InteropServices.Marshal.IsComObject(xxx) Then
>System.Runtime.InteropServices.Marshal.ReleaseComObject(xxx)
>
>On Mon, 1 Nov 2004 21:49:52 +0100
> "Clemens F. Vasters" <[EMAIL PROTECTED]> wrote:
>> Do you have Just In Time Activation enabled? If not, do
>> you Dispose()
>> from the client?
>>
>>
>> > -----Original Message-----
>> > From: Unmoderated discussion of advanced .NET topics.
>> [mailto:ADVANCED-
>> > [EMAIL PROTECTED] On Behalf Of Ken Benoit
>> > Sent: Monday, November 01, 2004 8:59 PM
>> > To: [EMAIL PROTECTED]
>> > Subject: [ADVANCED-DOTNET] COM+ Instance Count Does Not
>> Decrease When
>> > Called from .NET Application
>> >
>> > I have a VB.NET Serviced Component running in COM+ that
>> creates a
>> > PowerPoint Application object, several slides and then
>> saves the
>> > Presentation to disk. From within the same VB.NET
>> serviced component I
>> > then open the saved Presentation to a FileStream object
>> and read the
>> > contents with a BinaryReader into a Byte array to be
>> shipped over the
>> wire
>> > (function result Public Function GetPPTPresentation()
>> As Byte()
>> > Implements IRemotePowerPoint.GetPPTPresentation). I
>> then exported the
>> COM+
>> > package as an application proxy to be installed on a
>> separate server.
>> I
>> > can get the calling server to call into the .NET
>> Serviced component
>> and
>> > receive the Presentation no problem. I can even get
>> PowerPoint to
>> shutdown
>> > but the problem I am having is that the COM+ Instance
>> Count Does Not
>> > Decrease When Called from .NET Application. FYI it is
>> an ASP.NET
>> (VB.NET
>> > code behind) client calling a VB.NET serviced
>> component. Can provide
>> the
>> > code if necessary!
>> >
>> > ===================================
>> > This list is hosted by DevelopMentor(r)
>> http://www.develop.com
>> > Some .NET courses you may be interested in:
>> >
>> > Essential .NET: building applications and components
>> with C#
>> > November 29 - December 3, in Los Angeles
>> > http://www.develop.com/courses/edotnet
>> >
>> > View archives and manage your subscription(s) at
>> > http://discuss.develop.com
>>
>> ===================================
>> This list is hosted by DevelopMentor�
>> http://www.develop.com
>> Some .NET courses you may be interested in:
>>
>> Essential .NET: building applications and components with
>> C#
>> November 29 - December 3, in Los Angeles
>> http://www.develop.com/courses/edotnet
>>
>> View archives and manage your subscription(s) at
>> http://discuss.develop.com
>
>---------------------------------------------------------------------
>Web mail provided by NuNet, Inc. The Premier National provider.
>http://www.nni.com/
>
>===================================
>This list is hosted by DevelopMentor� http://www.develop.com
>Some .NET courses you may be interested in:
>
>Essential .NET: building applications and components with C#
>November 29 - December 3, in Los Angeles
>http://www.develop.com/courses/edotnet
>
>View archives and manage your subscription(s) at
http://discuss.develop.com
===================================
This list is hosted by DevelopMentor� http://www.develop.com
Some .NET courses you may be interested in:
Essential .NET: building applications and components with C#
November 29 - December 3, in Los Angeles
http://www.develop.com/courses/edotnet
View archives and manage your subscription(s) at http://discuss.develop.com