среда, 18 ноября 2009 г.

ASP.NET-полезное (Call Stack)

полезная статья как вытащить всю иерархию вызовов


StackTrace stackTrace = new StackTrace();
StackFrame stackFrame;
MethodBase stackFrameMethod;
int frameCount = 0;
string typeName;
do {
frameCount++;
stackFrame = stackTrace.GetFrame(frameCount);
stackFrameMethod = stackFrame.GetMethod();
typeName = stackFrameMethod.ReflectedType.FullName;
} while ( typeName.StartsWith("System") ||
typeName.EndsWith("CustomTraceListener") );

воскресенье, 15 ноября 2009 г.

Полезное (Google-сервисы)

Классная штука!

Google предлагает большое количество сервисов и API. К счастью они также предоставляет простой способ тестирования, изучения и создания любых приложений в Code Playground. Получите доступ к примерам API, сделайте в них изменения, отладьте, сохраните и экспортируйте свою работу.


Ссылка

пятница, 6 ноября 2009 г.

SQL-полезное (Fixing broken users after Database Restore)

Решение
В комментариях прикольно - I've been using this command since 5 years... and I always forget the syntax
Надо ж - таже фигня!!!

USE db_name
GO
EXEC sp_change_users_login 'Auto_Fix', 'user_name', NULL, 'password'
GO

вторник, 3 ноября 2009 г.

IVR-ссылки (Outbound+MSMQ+Service Unavailable+503)

Долго боролись с проблемой "зависания" приложения (оказалось просто MSMQ "банилась")
в ситуации когда при звонке на некоторые телефоны возвращалась ошибка 503 ServiceUnavailable
Вот как надо это лечить
еще
еще
Кроме того после выставления SipPeerException.ShouldThrottleMsmqCalls = false
у нас прекращались все события от SipPeerException (например обработка от this.TelephonySession.Close()), пришлось сделать "трюк" - заводили свой таймер и после истечения времени выставляли там статус звонка

Далее статья с первой ссылкой выше ...
One of the most common ways of queuing outbound calls with Speech Server is by using the built in MSMQ support. For the most part, using a message queue is extremely straightforward and easy to implement. But there is one gotcha – call throttling.

When an outbound call fails to connect, Speech Server will start throttling down the number of messages it pulls from the queue. The assumption is that failures are the result of your system having insufficient capacity to handle the load. The more failures your have, the more it will throttle the load. This would be acceptable if it were not for two issues:

Almost any failure, even acceptable ones, can result in throttling
It will happy throttle you all the way down to 0, effectively shutting down your application
Disabling call throttling needs to be done on a per-call bases by binding to the TelephonySession.OpenCompleted event prior to the MakeCall Activity. Typically I do this in a Code Activity at the very top of my workflow.

Inside my initWorkflow Activity I bind to the OpenCompleted like so:

TelephonySession.OpenCompleted += new EventHandler(TelephonySession_OpenCompleted);

Then I use the following to disable throttling on any failure:

void TelephonySession_OpenCompleted(object sender, Microsoft.SpeechServer.AsyncCompletedEventArgs e)
{
if (e.Error != null && e.Error is SipPeerException)
{
SipPeerException sipEx = e.Error as SipPeerException;
sipEx.ShouldThrottleMsmqCalls = false;
}
}