CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2011
    Posts
    1

    Unhappy Problem with sending Fax from VB.NET Windows Service

    I am trying to send the fax from my windows service which is written in vb.net. I am facing problem with windows 7 and windows 2008 Server. It works fine with Windows XP

    Fax is not getting visible in fax console's outbox. I saw three files in "C:\ProgramData\Microsoft\Windows NT\MSFax\Queue" for every sent fax but this is not visible in fax queue.

    I also observed that, when i am trying to send the fax from windows application then it works but anyhow it is getting failed when i am trying to send that from windows service.

    I have following code :

    Dim oFaxSvrType As Type = Type.GetTypeFromProgID("FaxcomEx.FaxServer")
    Dim oFaxSvr As Object = Activator.CreateInstance(oFaxSvrType)
    Dim oFaxDocType As Type = Type.GetTypeFromProgID("FaxcomEx.FaxDocument")

    Dim sFaxServerName As String

    Try
    sFaxServerName = Environment.MachineName.Trim

    oFaxSvr.Connect(sFaxServerName)
    oFaxSvr.Connect(sFaxServerName)

    Dim oFaxDoc As Object = Activator.CreateInstance(oFaxDocType)
    With oFaxDoc
    .Sender.FaxNumber = "1112223333"
    .Body = asfilename
    .Sender.Name = "test recipient"
    .Sender.OfficePhone = "123456789"
    .Recipients.add("1113332222")
    End With

    Dim sFaxJobIds() As String = oFaxDoc.ConnectedSubmit(oFaxSvr)
    oFaxDoc = Nothing

    Catch ex As Exception
    Throw New Exception(ex.Message)
    Finally
    ' clean up com components
    Try
    oFaxSvr.Disconnect()
    Catch ex As Exception
    End Try
    oFaxSvr = Nothing
    End Try


    I observed that in task manager, rundll32.exe is getting started when i tried to run this code from windows application but this rundll32.exe is not getting started when i am trying to run this code from windows service.

    I am not getting any exception after executing this code but not able to see the fax on outbox.

    I ensured that allow service to interact with desktop in service console is checked for fax service and my own windows service.

    I need this little bit urgent. Any help ?

  2. #2
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Problem with sending Fax from VB.NET Windows Service

    Windows 7 and 2008 server have tightend up security's ...

    Try using a different 'Log on as' user for the service, IE instead of 'Local Service' or 'Network Service', create a user specifically for this service, and give that user the applicable rights to send a fax, etc.......
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured