Simple alarm, Send, Ack idea here. Stuck with no way to debug. Not sure if this is an error with Stream Insight or my brain not working right.
Everything works great, popping events for every alarm every 20 minutes, until I get an Ack message. Then the query dies and I get the error on the next checkpoint.
I think my problem is with the
CreateSendEvent
query event being removed but I am not sure why.
static
void Main(string[]
args)
{
//
//
Add Check Points to recover from a start and Stop
//
var metaConfig =
new
SqlCeMetadataProviderConfiguration
{
DataSource = «C:\SI\CAA\SI_Critical_Alarm_Alert.sdf»,
CreateDataSourceIfMissing = true
};
// Set up checkpointing. This needs a location to place the log files.
var chkConfig =
new
CheckpointConfiguration
{
LogPath = «C:\SI\CAA»,
CreateLogPathIfMissing = true
};
using (var
server = Server.Create(«Default»,
metaConfig, chkConfig))
//
//
Add Check Points to recover from a start and Stop
//
//
//using (var server = Server.Create(«Default»)) // if just embedded SI
{
var host =
new
ServiceHost(server.CreateManagementService());
host.AddServiceEndpoint(typeof(IManagementService),
new
WSHttpBinding(SecurityMode.Message),
«http://localhost/SI_Critical_Alarm_Alert»);
host.Open();
//
Application myApp;
if (!server.Applications.TryGetValue(«SI_CAA»,
out myApp))
{
myApp = server.CreateApplication(«SI_CAA»);
}
CepProcess procAll;
if (myApp.Processes.TryGetValue(«CAA_All»,
out procAll))
{
Console.WriteLine(«Resuming
process…»);
procAll.Resume();
}
else
{
Console.WriteLine(«Creating
process…»);
//
// AJS 01/10/2013 Add Check Points to recover from a start and Stop
//
// SOURCE
// QUEUE Critical Alarm Alert Event (677) SQL
var mySourceMessages = myApp.DefineObservable<CAA_Message>(()
=> new
QEventCreator_CriticalAlarmAlert(677)).ToPointStreamable(
e => PointEvent.CreateInsert<CAA_Message>(DateTime.UtcNow,
e),
AdvanceTimeSettings.StrictlyIncreasingStartTime);
//QUERY
var FirstFilter =
from r
in mySourceMessages
where r.ActivityType != -1
select r;
var Opens =
from r
in FirstFilter
where r.ActivityType == 1
select r;
var Alarms =
from r
in FirstFilter
where r.ActivityType == 6
select r;
var ACKs =
from r
in FirstFilter
where r.ActivityType == 3
select r;
var Sents =
from r
in FirstFilter
where r.ActivityType == 4
select r;
Alarms = Alarms.AlterEventDuration(e => TimeSpan.MaxValue);
//
all events ending dates will be set to the starting date of the ACK event. If no ACK
event has yet happend, the ending date will stay open forever.
var OpenAlarms = Alarms.ClipEventDuration(ACKs, (e1, e2) => e1.Alarm_ID
== e2.Alarm_ID);
// Sents events lasts 20 minutes
Sents = Sents.AlterEventDuration(e => TimeSpan.FromMinutes(20));
// If no Sent event has happend yet, or the 20 minutes is up then a new one needs to happen.
var OpensWithNothingSent = OpenAlarms.LeftAntiJoin(Sents, (e1, e2) =>
e1.Alarm_ID == e2.Alarm_ID).AlterEventDuration(e => TimeSpan.FromTicks(1));
//
var CreateSendEvent =
from r
in OpensWithNothingSent
select
new
CAA_Message
{
Alarm_ID = r.Alarm_ID,
MessBody = r.MessBody,
ENCNTR_ID = r.ENCNTR_ID,
PRSNL_ID = r.PRSNL_ID,
ActivityType = 4,
Tree_Level
= FindTreeLevel(r.Alarm_ID),
AlarmDTTM = DateTime.Now
};
//Point to Signal Conversion http://msdn.microsoft.com/en-us/library/ee362414.aspx «fold pairs» http://www.devbiker.net/post/Cool-StreamInsight-querye28093Point-input-to-Edge-Output.aspx
var QryDone = Opens.Union(CreateSendEvent).Union(ACKs);
//SINK
var mySink_NewAlert = myApp.DefineObserver(()
=> Observer.Create<PointEvent<CAA_Message>>(OneSinktoRuleThemAll));
//BIND
procAll = QryDone.Bind(mySink_NewAlert).RunCheckpointable(«CAA_All»);
}
//if (myApp.Processes.TryGetValue(«LabNotify», out proc))
//RUN
using (CheckpointLoop(server, myApp.CheckpointableProcesses[«CAA_All»],
TimeSpan.FromSeconds(1)))
{
Console.WriteLine(«Started
checkpointing… Press enter to shut down normally…»);
Console.ReadLine();
//keep thread alive
}
//
Console.WriteLine(«Stopped
query.»);
//
host.Close();
} //using (var server = Server.Create(«Default», metaConfig, chkConfig))
}
System.AggregateException was caught
HResult=-2146233088
Message=One or more errors occurred.
Source=mscorlib
StackTrace:
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at SI_Critical_Alarm_Alert.Program.<>c__DisplayClass9.<CheckpointLoop>b__6(Int64 i) in c:TFSDatapumpsStreamInsightSI_Critical_Alarm_AlertSI_Critical_Alarm_AlertProgram.cs:line
375
InnerException: Microsoft.ComplexEventProcessing.ManagementException
HResult=-2146233088
Message=Could not find the corresponding event for an incoming retraction or expansion event. This can be caused by the usage of a non-deterministic user-defined function, aggregate or operator.
Source=Microsoft.ComplexEventProcessing.Diagnostics
StackTrace:
at Microsoft.ComplexEventProcessing.Diagnostics.Exceptions.Throw(Exception exception)
at Microsoft.ComplexEventProcessing.EmbeddedServerProxy.EndCheckpoint(IAsyncResult asyncResult)
at Microsoft.ComplexEventProcessing.CepCheckpointableProcess.<>c__DisplayClass7.<CheckpointAsync>b__3(IAsyncResult iar)
InnerException: Microsoft.ComplexEventProcessing.Engine.OperatorExecutionException
HResult=-2146233088
Message=Could not find the corresponding event for an incoming retraction or expansion event. This can be caused by the usage of a non-deterministic user-defined function, aggregate or operator.
Source=Microsoft.ComplexEventProcessing.Diagnostics
StackTrace:
at Microsoft.ComplexEventProcessing.Diagnostics.Exceptions.Throw(Exception exception)
at Microsoft.ComplexEventProcessing.Engine.AsyncResult`1.EndInvoke()
at Microsoft.ComplexEventProcessing.CommandDispatcher.CommandDispatcher.EndCheckpoint(IAsyncResult asyncResult)
at Microsoft.ComplexEventProcessing.EmbeddedServerProxy.EndCheckpoint(IAsyncResult asyncResult)
InnerException:
Any help will be appreciated,
Andrew
- Home
- Microsoft
- Exchange 2013
- Exchange 2013 Error code -2146233088 – Exceeded Maximum Number Of Large Items
Exchange 2013 Error code -2146233088 – Exceeded Maximum Number Of Large Items
Written by Allen White on November 26, 2012. Posted in Exchange 2013
If you have a PST file with a large amount of emails in it and you want to import the PST into Exchange 2013 then you will use the New-MailboxImportRequest Normally the only problems you can get with this is if there are corrupted emails in your mailbox. In Exchange 2013 their is an additional option for LargeItemLimit, this needs specifying how many large items you would like to ignore the size of and import them, Exchange 2013 will only let you ignore a maximum of 50 “large” emails before it will fail again without the additional “AcceptLargeDataLoss” where you can specify that its OK to move the mail between mailboxes and anything over 50 large emails will be ignored. If you do not specify these commands you get the Error code -2146233088. You can specify what is a large email with the set-transportconfig command.
Below I will show you how use this command in powershell.
Exchange 2013 Specify LargeItemLimit In Powershell
First the command then the explanation.
New-MailboxImportRequest -Mailbox Allen -FilePath \techieshelpPSTFilesallenAllen.pst
In the command above the -Mailbox “Allen” is the Exchange 2013 mailbox we are importing to and the -Filepath is the location of Allen`s PST. We do not specify a folder so all emails and folders are imported into the root of Allen.
If we wanted to restore these emails to a specified folder then we would add the -TargetRootFolder “RestoredPST” flag, where RestoredPST is a folder in allen. If the PST file had Large emails attachments we would use the command below
New-MailboxImportRequest -Mailbox Allen -LargeItemLimit 50 -FilePath \techieshelpPSTFilesallenAllen.pst
The LargeItemLimit 50 allows 50 “large” emails to be skipped before the import is marked as failed, if there are more we need to issue the AcceptLargeDataLoss command as below to allow the import to be successful,
New-MailboxImportRequest -Mailbox Allen -LargeItemLimit 50 -AcceptLargeDataLoss -FilePath \techieshelpPSTFilesallenAllen.pst
This will drop all “large” emails after it has imported 50.
Tags: import, pst
Allen White
Allen is an IT Consultant and holds the following accreditations. MCSA, MCSE, MCTS, MCITP, CCA, CCSP, VCP 4,5, 6 and HP ASE, AIS — Network Infrastructure.
Search
I have been trying to convert the example code for excel vba to work in the 64-bit environment. I have gotten past the .GetPrinterName property not working for Bullzip.PDFSettings. I was able to get it from Bullzip.PDFUtil.defaultprintername. I cannot get past getting the Bullzip.PDFSettings.printername . The code below will give an run-time error «-2146233088 (80131500)»: This PrinterName property must be set before calling the GetFileSettingsFilePath Method.
Function PrintSheetAsPDF(file_name As String, merge_file_name As String, doc_title As String, author As String, save_path As String, subject_name As String, keywords As String)
Dim obj_printer_settings As Object
Dim obj_printer_util As Object
Dim current_printer As String
Dim progid As String
Dim utilprogid As String
Dim printername As String
Dim full_printer_name As String
Dim New64bitOS As Boolean
New64bitOS = False
#If VBA7 Then
‘ code running the new vba7 editor
#If Win64 Then
‘ code is running in 64-bit version of Microsoft office
New64bitOS = True
#End If
#End If
Rem — Set the program id of the automation object.
If New64bitOS Then
progid = «Bullzip.PdfSettings»
utilprogid = «Bullzip.PDFUtil»
Set obj_printer_util = CreateObject(utilprogid)
Rem — Create the object to control the printer settings
Set obj_printer_settings = CreateObject(progid)
Rem — Get default printer name
printername = obj_printer_util.defaultprintername
Else
progid = «Bullzip.PDFPrinterSettings»
utilprogid = «»
Rem — Create the object to control the printer settings
Set obj_printer_settings = CreateObject(progid)
Rem — Get default printer name
printername = obj_printer_settings.GetPrinterName
End If
Rem — Get the full name of the printer
full_printer_name = FindPrinter(printername)
full_printer_name = GetFullNetworkPrinterName(full_printer_name)
Rem — Prompt the user for a file name
‘ file_name = InputBox(«Save PDF to desktop as:», «Sheet ‘» & _
‘ ActiveSheet.Name & «‘ to PDF…», ActiveSheet.Name)
Rem — Abort the process if the user cancels the dialog
If file_name = «» Then Exit Function
Rem — Make sure that the file name ends with .pdf
If LCase(Right(file_name, 4)) <> «.pdf» Then
file_name = file_name & «.pdf»
End If
Rem — Write the settings to the printer
Rem — Settings are written to the runonce.ini
Rem — This file is deleted immediately after being used.
With obj_printer_settings
.SetValue «output», save_path & file_name
.SetValue «showsettings», «never»
.SetValue «ConfirmOverwrite», «no»
.SetValue «ShowPDF», «no»
.SetValue «Target», «prepress»
.SetValue «Author», author
.SetValue «Title», doc_title
.SetValue «Subject», subject_name
.SetValue «Keywords», keywords
.SetValue «UseThumbs», «no»
.SetValue «AutoRotatePages», «all»
.SetValue «Linearize», «yes»
.SetValue «Res», «3600»
If merge_file_name <> «» Then
.SetValue «MergeFile», save_path & merge_file_name
.SetValue «MergePosition», «bottom»
End If
.WriteSettings True
End With
Rem — Change to PDF printer
current_printer = ActivePrinter
ActivePrinter = full_printer_name
Rem — Print the active work sheet
ActiveSheet.PrintOut
Rem — Restore the printer selection
ActivePrinter = current_printer
End Function
Подскажите пожалуйста, в чем может быть причина. уже 2 недели бьюсь над ней.
На C# подписываю xml файл с помощью CryptSignMessage(…). Если подпись not detached (второй параметр false)
то всё нормально проверяется с помощью VerifyApi(….), а если подпись detached (2-ой параметр true),
то функция VerifyDetachApi() (ниже по тексту) в CryptVerifyDetachedMessageSignature(…)
выдает exception Hresult = — 2146233088 (COR_E_EXCEPTION 0x80131500)
Marshal.GetLastWin32Error() возвращает 0
static bool VerifyApi(byte[] data, byte[] signature)
{
GCHandle pCertContext;
pCertContext = GCHandle.Alloc(IntPtr.Zero, GCHandleType.Pinned);
Byte[] pbSignedMessageBlob = signature;
Int32 cbSignedMessageBlob = signature.Length;
Byte[] pbDecodedMessageBlob = null;
int cbDecodedMessageBlob = 0;
// Initialize the VerifyParams data structure.
CryptoApi.CRYPT_VERIFY_MESSAGE_PARA VerifyParams = new CryptoApi.CRYPT_VERIFY_MESSAGE_PARA();
VerifyParams.cbSize = Marshal.SizeOf(VerifyParams);
VerifyParams.dwMsgAndCertEncodingType = CryptoApi.MY_ENCODING_TYPE;
VerifyParams.hCryptProv = 0;
VerifyParams.pfnGetSignerCertificate = IntPtr.Zero;
VerifyParams.pvGetArg = IntPtr.Zero;
// With two calls to CryptVerifyMessageSignature, verify and decode
// the signed message.
// First, call CryptVerifyMessageSignature to get the length of the
// buffer needed to hold the decoded message.
//
bool res = CryptoApi.CryptVerifyMessageSignature(
ref VerifyParams, // Verify parameters.
0, // Signer index.
pbSignedMessageBlob, // Pointer to signed BLOB.
cbSignedMessageBlob, // Size of signed BLOB.
pbDecodedMessageBlob, // Buffer for decoded message.
ref cbDecodedMessageBlob, // Size of buffer.
pCertContext.AddrOfPinnedObject() // Pointer to signer certificate.
);
if (res == false)
{
throw new Exception(«CryptVerifyMessageSignature error», new Win32Exception(Marshal.GetLastWin32Error()));
}
// Allocate memory for the buffer.
//
pbDecodedMessageBlob = new Byte[cbDecodedMessageBlob];
// Call CryptVerifyMessageSignature again to copy the message into
// the buffer.
//
res = CryptoApi.CryptVerifyMessageSignature(
ref VerifyParams, // Verify parameters.
0, // Signer index.
pbSignedMessageBlob, // Pointer to signed BLOB.
cbSignedMessageBlob, // Size of signed BLOB.
pbDecodedMessageBlob, // Buffer for decoded message.
ref cbDecodedMessageBlob, // Size of buffer.
pCertContext.AddrOfPinnedObject() // Pointer to signer certificate.
);
if (res == false)
{
throw new Exception(«CryptVerifyMessageSignature error», new Win32Exception(Marshal.GetLastWin32Error()));
}
else
{
return true;
}
}
static bool VerifyDetachApi(byte[] messageData, byte[] signatureData) //, out byte[] p_x509
{
// Verify the message signature.
CryptoApi.CRYPT_VERIFY_MESSAGE_PARA verifyParams;
IntPtr buffer = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(byte)) * messageData.Length); // AllocHGlobal
Marshal.Copy(messageData, 0, buffer, messageData.Length);
IntPtr[] rgpbToBeSigned = new IntPtr[1] { buffer };
//rgpbToBeSigned[0] = buffer;
int[] rgcbToBeSigned = new int[1] { messageData.Length };
Marshal.FreeCoTaskMem(buffer);
//p_x509 = null;
GCHandle pCertContext;
verifyParams = new CryptoApi.CRYPT_VERIFY_MESSAGE_PARA();
verifyParams.cbSize = (int)Marshal.SizeOf(verifyParams);
verifyParams.dwMsgAndCertEncodingType = CryptoApi.MY_ENCODING_TYPE; //CryptoConstants.X509_ASN_ENCODING | CryptoConstants.PKCS_7_ASN_ENCODING;
verifyParams.hCryptProv = 0;
verifyParams.pfnGetSignerCertificate = IntPtr.Zero;
verifyParams.pvGetArg = IntPtr.Zero;
pCertContext = GCHandle.Alloc(IntPtr.Zero, GCHandleType.Pinned);
try
{
bool res = CryptoApi.CryptVerifyDetachedMessageSignature(
ref verifyParams, // Verify parameters.
0, // Signer index.
signatureData, // Buffer for decoded message.
signatureData.Length, // Size of buffer.
1,
rgpbToBeSigned, // Pointer to signed BLOB.
rgcbToBeSigned, // Size of signed BLOB.
pCertContext.AddrOfPinnedObject());//pCertContext.AddrOfPinnedObject()
if (!res)
{
throw new Exception(«Error while encrypting data [» + Marshal.GetLastWin32Error() + «].»);
}
try
{
X509Certificate x509 = new X509Certificate((IntPtr)pCertContext.Target);
}
finally
{
CryptoApi.CertFreeCertificateContext((IntPtr)pCertContext.Target);
}
return res;
}
finally
{
pCertContext.Free();
}
}
[StructLayout(LayoutKind.Sequential)]
public struct CRYPT_VERIFY_MESSAGE_PARA
{
public int cbSize;
public uint dwMsgAndCertEncodingType;
public int hCryptProv;
public IntPtr pfnGetSignerCertificate;
public IntPtr pvGetArg;
}
[DllImport(«Crypt32.dll», SetLastError = true)]
public static extern Boolean CryptVerifyMessageSignature(
ref CRYPT_VERIFY_MESSAGE_PARA pVerifyPara,
Int32 dwSignerIndex,
Byte[] pbSignedBlob,
Int32 cbSignedBlob,
Byte[] pbDecoded,
ref Int32 pcbDecoded,
IntPtr ppSignerCert
);
[DllImport(«Crypt32.dll», SetLastError = true)]
static internal extern bool CryptVerifyDetachedMessageSignature(
ref CRYPT_VERIFY_MESSAGE_PARA pVerifyPara,
int dwSignerIndex,
byte[] pbDetachedSignBlob,
int cbDetachedSignBlob,
int cToBeSigned,
IntPtr[] rgpbToBeSigned,
int[] rgcbToBeSigned,
IntPtr ppSignerCert);