Click here to Skip to main content
       

ASP.NET

 
GeneralRe: sequence contains no elements PinmemberMatt U.19-Dec-12 1:47 
Question[session] returns null PinmemberxnaLearner17-Dec-12 23:20 
AnswerRe: [session] returns null PinmemberRahul Rajat Singh17-Dec-12 23:47 
GeneralRe: [session] returns null PinmemberxnaLearner18-Dec-12 0:10 
GeneralRe: [session] returns null PinmemberxnaLearner18-Dec-12 0:12 
SuggestionRe: [session] returns null PinmemberChandrabhan Sangale18-Dec-12 17:59 
QuestionMultilingual support for Web Application PinmemberAB777117-Dec-12 23:18 
AnswerRe: Multilingual support for Web Application PinmemberRahul Rajat Singh17-Dec-12 23:43 
GeneralRe: Multilingual support for Web Application PinmemberAB777118-Dec-12 2:27 
AnswerRe: Multilingual support for Web Application Pinmemberdeflinek17-Dec-12 23:57 
SuggestionRe: Multilingual support for Web Application PinmemberChandrabhan Sangale18-Dec-12 18:01 
Questiongoogle map Pinmembercdpsource17-Dec-12 20:52 
AnswerRe: google map Pinmemberryanb3118-Dec-12 4:55 
QuestionProblem to send message from MSMQ PinmemberTRAORE cheickna17-Dec-12 10:20 
Hello,
 
I created a WCF service into my asp.net app in order to store some messages into queue using MSMQ before send them to users. The first part work fine because i can see all messages in a pickup directory with Windows Explorer. I also can see the message number using windows service manager throw my private queue.
 
The second part don't work i.e my messages aren't sent and i have no error message. I don't understand where the problem come from. The code i use is following :
 
msmqQueuePath is my Queue name
 
Public Sub GetMailMessages() Implements ISvcEmailManagement.GetMailMessages
 
        Try
            ' Create an instance of MessageQueue. Set its formatter.
            Dim _msmqQueue As New MessageQueue(msmqQueuePath)
            '_msmqQueue.Formatter = New XmlMessageFormatter(New Type() {GetType([String])})
            _msmqQueue.Formatter = New BinaryMessageFormatter
            _msmqQueue.MessageReadPropertyFilter.SetAll()
            ' Add an event handler for the ReceiveCompleted event.
            AddHandler _msmqQueue.ReceiveCompleted, AddressOf msmqQueue_ReceiveCompleted
            Dim returnValue As IAsyncResult
            ' Begin the asynchronous receive operation.
            returnValue = _msmqQueue.BeginReceive()
            signal.WaitOne()
            ' Do other work on the current thread.
            Return
        Catch ex As Exception
            Dim Msg As String = ex.Message
            Throw ex
        End Try
 
    End Sub
 
 
The receiveCompleted function is :
 
Public Sub msmqQueue_ReceiveCompleted(ByVal sender As Object, ByVal e As ReceiveCompletedEventArgs)
        Try
            Dim emailMsg As EmailEntities.CEmailMessage = e.Message.Body
            'Remplir l'objet Message avec TO, FROM, BODY, SUBJECT en supposant que le message soit au bon format
            Dim mailMessage As MailMessage = New MailMessage()
            mailMessage.To.Add(New MailAddress(emailMsg.sTO))
            mailMessage.From = New MailAddress(emailMsg.sFROM)
            mailMessage.Subject = emailMsg.sSUBJECT
            mailMessage.Body = emailMsg.sBODY
            Dim oclient As SmtpClient = New SmtpClient()
            Try
                oclient.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory
                oclient.Send(mailMessage)
            Catch ex As SmtpFailedRecipientsException
                Dim i As Integer
                For i = 0 To ex.InnerExceptions.Length - 1
                    Dim status As SmtpStatusCode = ex.InnerExceptions(i).StatusCode
                    If (status = SmtpStatusCode.MailboxBusy) Or (status = SmtpStatusCode.MailboxUnavailable) Then
                        'Echec à l'envoi du message : tentative dans 5 secondes
                        System.Threading.Thread.Sleep(5000)
                        oclient.Send(mailMessage)
                    Else
                        'Echec d'envoi du message à {0}
                        MsgBox("Failed to deliver message to {0}", MsgBoxStyle.Information, ex.InnerExceptions(i).FailedRecipient)
                    End If
                Next i
            Catch ex As SmtpException
                Dim msstatus As String = ex.Message
            End Try
        Catch ex As SmtpException
            Dim msstatus As String = ex.Message
        Catch ex As Exception
            Dim msstatus As String = ex.Message
            'Catch ex As XmlException
            '    Dim msstatus As String = ex.Message
        End Try
    End Sub
 

Thanks a lot for any help
Questionexport report failed in crystal report Pinmemberhimadribanik17-Dec-12 6:51 
QuestionRefresh particular parts on masterpage Pinmembercdpsource17-Dec-12 5:58 
AnswerRe: Refresh particular parts on masterpage PinmemberMatt U.17-Dec-12 6:51 
GeneralRe: Refresh particular parts on masterpage Pinmembercdpsource17-Dec-12 6:59 
GeneralRe: Refresh particular parts on masterpage PinmemberMatt U.17-Dec-12 7:06 
GeneralRe: Refresh particular parts on masterpage Pinmembercdpsource17-Dec-12 8:23 
SuggestionRe: Refresh particular parts on masterpage PinmemberChandrabhan Sangale18-Dec-12 18:04 
Questionsession variable / temp data PinmemberxnaLearner17-Dec-12 4:25 
QuestionSalable Comet (server hang while more user) Pinmembervaibhav.baldha17-Dec-12 3:47 
AnswerRe: Salable Comet (server hang while more user) PinmemberChandrabhan Sangale18-Dec-12 17:49 
QuestionThe underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. Pinmemberkapil sharma 4917-Dec-12 2:02 
AnswerRe: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. Pinmemberryanb3118-Dec-12 4:58 
QuestionCan only book for yourself and not other users? PinmemberxnaLearner17-Dec-12 1:29 
QuestionRe: Can only book for yourself and not other users? PinmemberZaf Khan19-Dec-12 5:49 
QuestionEval + onclientClick Gridview Error [modified] Pinmemberjojoba201116-Dec-12 20:38 
QuestionRe: Eval + onclientClick Gridview Error Pinmemberryanb3118-Dec-12 4:59 
QuestionSound transmission Pinmemberleone16-Dec-12 5:16 
QuestionRe: Sound transmission Pinmemberryanb3118-Dec-12 5:00 
AnswerRe: Sound transmission Pinmemberleone18-Dec-12 23:22 
GeneralRe: Sound transmission Pinmemberryanb3119-Dec-12 1:38 
GeneralRe: Sound transmission Pinmemberleone19-Dec-12 2:54 
QuestionDropDownList changed after reading SelectedValue !!!! [modified] PinmemberAdore C++15-Dec-12 9:11 
AnswerRe: DropDownList changed after reading SelectedValue !!!! Pinmemberrakak15-Dec-12 18:29 
GeneralRe: DropDownList changed after reading SelectedValue !!!! PinmemberAdore C++16-Dec-12 4:18 
GeneralRe: DropDownList changed after reading SelectedValue !!!! Pingroupchester_it2116-Dec-12 9:10 
QuestionIIS7.5 Specific Problem PinmemberAyan Chatterjee15-Dec-12 7:07 
QuestionRe: IIS7.5 Specific Problem Pinmemberryanb3118-Dec-12 5:01 
QuestionResponse and Redirect PinmemberAni199115-Dec-12 3:32 
AnswerRe: Response and Redirect Pinmemberjkirkerx16-Dec-12 18:17 
AnswerRe: Response and Redirect Pingroupchester_it2117-Dec-12 17:41 
QuestionSlideShow Pinmembercdpsource14-Dec-12 12:28 
AnswerRe: SlideShow Pinmemberryanb3118-Dec-12 5:04 
Questiontwo buttons in one page PinmemberJassim Rahma14-Dec-12 7:55 
AnswerRe: two buttons in one page PinmemberElham M15-Dec-12 1:26 
AnswerRe: two buttons in one page PinmvpRichard MacCutchan15-Dec-12 2:21 
AnswerRe: two buttons in one page [modified] PinmemberCommDev15-Dec-12 20:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 29 Aug 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid