0

所以我有一個非常奇怪的問題。WebDAV&Exchange 2003 - 在調試中工作,失敗沒有

我正在寫一些VB.Net下的.NET 2.0的接口與MS Exchange 2003的代碼。由於Exchange 2003「要求」,我不得不使用WEBDAV編寫此代碼。

代碼本身在某種程度上正在複製進度管理過程。它在Exchange Server上創建約會以響應用戶的輸入並在SQL Server數據庫內部管理其數據。 問題情況是這樣的:一個新人被分配負責會議。該要求表示,計劃應該向離開會議的人(如果存在這樣的人)以及發送給新人的會議請求生成會議取消請求。

在有作爲現有人員的情況下,這似乎正好是這樣的:

  1. 會議取消請求 被髮送
  2. 交易所barfs,並在返回狀態代碼500(內部服務器錯誤) 請求將會議請求發送給新人。

但是!在調試這個特定的場景時,如果我逐句通過Visual Studio調試器中的代碼,它對我來說工作得很好。留給它自己的設備,它每次都失敗。

只爲議員的緣故,我添加了一個Thread.Sleep(500)的部分發送取消請求後,交易已經不BARF ...

所以,我的問題!

如果向代碼中添加Thread.Sleep會導致此錯誤消失,則表示競爭條件隱含,否?但是,我的代碼在Web應用程序下運行,並且從頭到尾都是完全單線程的過程。我發送的網絡請求都處於同步模式,所以這應該不成問題。

接下來我會做什麼來嘗試追蹤問題?

  • 如果競爭條件本身在.Net 2.0 BCL網絡代碼中,試試看還是神聖的?
  • 嘗試在Exchange服務器本身上進行一些調試?
  • 忽略它,高興Thread.Sleep掩蓋問題並繼續前進?

任何進一步的建議將是美好的。


對此發表評論,我可以張貼的失敗函數:

Private Shared Sub UpdateMeeting(ByVal folder As String, ByVal meetingId As String, ByVal oldAssignedId As String, ByVal newAssignedTo As String, ByVal transaction As DbTransaction) 
     If String.IsNullOrEmpty(meetingId) Then 
      Throw New Exception("Outlook ID for that date and time is empty.") 
     End If 
     Dim x As New Collections.Generic.List(Of String) 
     If oldAssignedId <> newAssignedTo AndAlso Not String.IsNullOrEmpty(oldAssignedId) Then 
      'send cancellation to old person 
      Dim lGetCounselorEmail1 As String = GetCounselorEmail(oldAssignedId, transaction) 
      Common.Exchange.SendCancellation(meetingId, New String() {lGetCounselorEmail1}) 
      ' Something very weird here. Running this code through the debugger works fine. Running without causes exchange to return 500 - Internal Server Error. 
      Threading.Thread.Sleep(500) 
     End If 
     x.Add(folder) 
     If Not String.IsNullOrEmpty(newAssignedTo) Then x.Add(GetCounselorEmail(newAssignedTo, transaction)) 
     x.RemoveAll(AddressOf String.IsNullOrEmpty) 
     If x.Count > 0 Then 
      If Not Common.Exchange.UpdateMeetingAttendees(meetingId, x.ToArray()) Then 
       Throw New Exception("Failure during update of calendar") 
      End If 
     End If 
    End Sub 

...但很多的實施細節隱藏在這裏,因爲我寫了一組類與接口交換WebDAV。

+0

在'睡眠'之前和之後看幾行代碼會很有用。 – 2010-09-23 20:24:11

回答

0

結束了堅持睡眠,並稱它爲一天。

我的觀點是,我錯誤地認爲通過WebDav發送到Exchange的WebRequest/WebResponse組合是一個原子操作。

+0

任何解決方案? – Kiquenet 2010-11-23 17:53:59

相關問題