RPC server unavailable
im trying to create a COM object from a webservice running on IIS 6.0 win2003 server. I followed the previous article, and spawned a new single apartment thread from the webmethod, and passed it the object. that seems to work correctly. however, when i try to create the COM object, im getting a “RPC Server is unavailable.” I was getting this same error prior to incorporating the thread design. any ideas why I would get this message? might be a win2003 server error.
here is my webmethod code…
Dim myThread As System.Threading.Thread
Dim myFax As New FaxingWrapper(FaxNumber, EPDealerNum, p_RemotePath)
myThread = New System.Threading.Thread(AddressOf myFax.Send)
myThread.ApartmentState = System.Threading.ApartmentState.STA
myThread.Start()
If myThread.IsAlive Then
myThread.Join()
End If
p_message = myFax.Message
here is my FaxWrapper class code…
ublic Class FaxingWrapper
Private rfFaxAPI As RFCOMAPILib.FaxServer
Private newFax As RFCOMAPILib.Fax
Private p_message As String
Private p_FaxNumber As String
Private p_EPDealernum As String
Private p_FilePath As String
Public Sub New(ByVal FaxNumber As String, ByVal EPDealernum As Integer, ByVal FilePath As String)
p_FaxNumber = FaxNumber
p_EPDealernum = EPDealernum
p_FilePath = FilePath
End Sub
Public Sub Send()
DoFax()
End Sub
ReadOnly Property Message() As String
Get
Return p_message
End Get
End Property
Private Sub DoFax()
Try
rfFaxAPI = New RFCOMAPILib.FaxServer
‘***** ERROR OCCURS ON NEXT LINE *****
newFax = rfFaxAPI.CreateObject(RFCOMAPILib.CreateObjectType.coFax)
rfFaxAPI.ServerName = “fax”
rfFaxAPI.UseNTAuthentication = True
rfFaxAPI.AuthorizationUserID = “faxacct”
rfFaxAPI.AuthorizationUserPassword = “faxpassword”
rfFaxAPI.Protocol = RFCOMAPILib.CommunicationProtocolType.cpTCPIP
newFax.ToFaxNumber = “18889999999” ‘p_faxnumber
newFax.ToName = “testname”
newFax.Attachments.Add(“test.txt”)
newFax.Send()
p_message = newFax.StatusDescription
Catch ex As Exception
p_message = ex.Message
End Try
End Sub
End Class